:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --text: #20252d;
    --muted: #6c7480;
    --line: #d9dee7;
    --accent: #0f766e;
    --accent-soft: #e3f5f1;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

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

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: relative;
    z-index: 20;
    height: 58px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 0 22px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-size: 18px;
    font-weight: 700;
}

.topbar-center {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
    flex-wrap: wrap;
}

.user-menu {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.user-menu > span {
    max-width: min(260px, 28vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu .button {
    min-height: 32px;
    padding: 6px 10px;
}

.topbar-upload {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.topbar-upload-action {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 10px;
    cursor: pointer;
    white-space: nowrap;
}

.topbar-upload-action input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0;
    cursor: pointer;
}

.topbar-upload-status {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    z-index: 30;
    width: min(520px, 82vw);
    padding: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    box-shadow: 0 14px 36px rgba(32, 37, 45, .16);
    transform: translateX(-50%);
}

.topbar-upload-status ul {
    max-height: 62px;
}

.account-expiry {
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.account-expiry.expiry-warning {
    background: #fff1f0;
    color: #9f2d24;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background-color: #eef4f2;
    background-image:
        linear-gradient(135deg, rgba(247, 248, 250, .52) 0%, rgba(238, 244, 242, .36) 100%),
        var(--login-background-image, linear-gradient(135deg, #f7f8fa 0%, #eef4f2 100%));
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.login-shell {
    width: min(420px, 100%);
}

.login-panel {
    padding: 28px;
    background: rgba(255, 255, 255, .94);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(32, 37, 45, .24);
    backdrop-filter: blur(8px);
}

.login-brand {
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.login-panel h1 {
    margin: 8px 0 10px;
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.login-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.login-form input,
.login-form select {
    min-height: 42px;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

.login-form input:focus,
.login-form select:focus {
    outline: 2px solid rgba(15, 118, 110, .18);
    border-color: var(--accent);
}

.primary-button {
    width: 100%;
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.primary-button:hover {
    background: #0d635d;
    color: #ffffff;
}

.login-error {
    margin: 18px 0 0;
    padding: 10px 12px;
    background: #fff1f0;
    border: 1px solid #f1b8b4;
    border-radius: 6px;
    color: #9f2d24;
    font-weight: 700;
    white-space: pre-line;
}

.password-rules {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.password-option {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    width: fit-content;
    color: var(--text) !important;
    font-size: 13px;
}

.password-option input {
    width: auto;
    min-height: 0;
    padding: 0;
    accent-color: var(--accent);
}

.layout {
    min-height: calc(100vh - 58px);
}

.sidebar {
    padding: 22px;
    background: var(--panel);
    border-right: 1px solid var(--line);
}

.sidebar-title,
.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.project-list {
    display: grid;
    gap: 6px;
    margin-top: 14px;
}

.project-list a {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
}

.project-list a:hover,
.project-list a.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.content {
    padding: 28px 48px;
}

.project-detail-content {
    position: relative;
    isolation: isolate;
    min-height: calc(100vh - 58px);
    overflow: hidden;
}

.project-detail-content::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image: var(--page-image);
    background-position: left 48px top 78px;
    background-repeat: no-repeat;
    background-size: calc(100% - 96px) auto;
    opacity: .82;
}

.project-detail-content::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(246, 247, 249, .12) 0%, rgba(246, 247, 249, .2) 44%, rgba(246, 247, 249, .36) 100%);
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.project-picker-heading {
    justify-content: center;
    margin: 18px 0 28px;
    text-align: center;
}

.project-picker-heading h1 {
    margin: 0;
    font-size: 34px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 13px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}

.button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.button.is-active {
    border-color: var(--accent);
    color: var(--accent);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .58;
}

h1 {
    margin: 6px 0 0;
    font-size: 28px;
    line-height: 1.2;
}

h2 {
    margin: 28px 0 12px;
    font-size: 18px;
}

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

.message {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.message p {
    margin: 6px 0 0;
}

.warning-message {
    border-color: #e7b263;
    background: #fff8eb;
    color: #7d4f00;
}

.diagnostic-message {
    border-color: #9bb7df;
    background: #f0f6ff;
    color: #233b5e;
}

.success-message {
    border-color: #8bc7a0;
    background: #effaf3;
    color: #285c3a;
}

.flash-stack {
    position: fixed;
    top: 74px;
    right: 24px;
    z-index: 45;
    width: min(420px, calc(100vw - 32px));
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.flash-message {
    margin: 0;
    box-shadow: 0 12px 30px rgba(32, 37, 45, .16);
    transition: opacity .25s ease, transform .25s ease;
}

.flash-message p {
    margin: 0;
}

.flash-message.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}
