/* ─── Auth pages ─────────────────────────────────────────────────────────── */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background-color: var(--background);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    padding: 2.5rem 2rem;
}

.auth-wordmark {
    display: block;
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--foreground);
}

.auth-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--foreground-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.auth-alert {
    background-color: hsl(0, 60%, 96%);
    border: 1px solid hsl(0, 40%, 88%);
    color: hsl(0, 55%, 35%);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

/* ─── Fields ─── */

.field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.field-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--foreground-muted);
}

.field-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.field-link {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.field-link:hover {
    color: var(--accent-hover);
}

.field-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background-color: var(--background);
    color: var(--foreground);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}

.field-input:focus {
    border-color: var(--accent);
}
.field-input::placeholder {
    color: var(--foreground-subtle);
}

/* ─── Checkbox ─── */

.field-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.check-input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.check-label {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--foreground-muted);
    cursor: pointer;
}

/* ─── Full-width button ─── */

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 0.625rem;
    font-size: 0.9375rem;
}

/* ─── Auth footer text ─── */

.auth-footer-text {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--foreground-subtle);
    text-align: center;
    margin-top: 1.5rem;
}

.auth-link {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-link:hover {
    color: var(--accent-hover);
}

/* ─── App shell ─── */

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.verify-banner {
    background-color: hsl(38, 80%, 90%);
    border-bottom: 1px solid hsl(38, 50%, 78%);
    padding: 0.625rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: hsl(30, 50%, 30%);
    flex-wrap: wrap;
}

.verify-banner-btn {
    background: none;
    border: 1px solid hsl(38, 50%, 65%);
    border-radius: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: hsl(30, 50%, 30%);
    cursor: pointer;
    transition: background-color 0.15s;
}

.verify-banner-btn:hover {
    background-color: hsl(38, 60%, 84%);
}

.app-header {
    border-bottom: 1px solid var(--border);
    background-color: var(--background);
    position: sticky;
    top: 0;
    z-index: 40;
}

.app-header-inner {
    max-width: 1080px;
    margin-inline: auto;
    padding-inline: 1.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-ghost {
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.25rem 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--foreground-muted);
    cursor: pointer;
    transition:
        border-color 0.15s,
        color 0.15s;
}

.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--foreground);
}

.app-heading {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

/* ─── Flash notices ─── */

.flash-notice {
    background-color: hsl(140, 50%, 93%);
    border: 1px solid hsl(140, 35%, 80%);
    color: hsl(140, 50%, 25%);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
}

.appnav-flash {
    max-width: 900px;
    margin: 0.75rem auto 0;
    padding-inline: 1.5rem;
}

/* ─── App nav ─── */

.app-body {
    background-color: var(--background);
    min-height: 100vh;
    position: relative;
}

/* Noise on the app shell too */
.app-body .noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("/assets/noise-b0b454e7.png");
    background-size: 180px 180px;
    background-repeat: repeat;
}

/* ─── Top bar ─── */

.apptopbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    height: 3.5rem;
    pointer-events: none;
}

.apptopbar-inner {
    max-width: 1280px;
    margin-inline: auto;
    padding-inline: 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    pointer-events: auto;
}

.apptopbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.apptopbar-dropdown {
    bottom: auto !important;
    top: calc(100% + 0.375rem);
}

/* ─── Logo dropdown ─── */

.applogobar-menu {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: auto;
}

.applogobar-menu summary {
    list-style: none;
}

.applogobar-menu summary::-webkit-details-marker {
    display: none;
}

.applogobar-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    user-select: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.15s;
}

.applogobar-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.applogobar-btn .appnav-chevron {
    opacity: 0.5;
}

.applogobar-menu[open] .appnav-chevron {
    transform: rotate(180deg);
}

.applogobar-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%);
    width: 26rem;
    background-color: white;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    padding: 0.625rem;
    z-index: 200;
}

.applogobar-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.625rem;
}

.applogobar-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    border-radius: 0.5rem;
    color: var(--foreground-muted);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-decoration: none;
    transition: background-color 0.12s, color 0.12s;
}

.applogobar-action:hover {
    background-color: var(--surface);
    color: var(--foreground);
}

.applogobar-action svg {
    width: 1.5rem;
    height: 1.5rem;
}

.applogobar-search-wrap {
    margin-bottom: 0.625rem;
}

.applogobar-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--foreground);
    background-color: var(--surface);
    outline: none;
}

.applogobar-search::placeholder {
    color: var(--foreground-subtle);
}

.applogobar-section {
    border-top: 1px solid var(--border);
    padding-top: 0.625rem;
}

.applogobar-section-title {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--foreground-subtle);
    margin-bottom: 0.5rem;
}

.applogobar-section-empty {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--foreground-subtle);
    padding: 0.5rem 0;
}

/* ─── Sheet ─── */

.app-main {
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.32s ease;
    transform-origin: top center;
}

.sheet-bg--pushed {
    transform: scale(0.91) translateY(-24px);
    opacity: 0.4;
    border-radius: 0.625rem;
    overflow: hidden;
}

.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    pointer-events: none;
}

.sheet-overlay--open {
    pointer-events: auto;
}

.sheet-panel {
    position: absolute;
    bottom: 4.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: calc(1280px + 3rem);
    max-height: calc(100dvh - 4.5rem - 3.5rem - 5px);
    background: white;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 1.25rem 1.25rem 0 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
}

.sheet-overlay--open .sheet-panel {
    transform: translateX(-50%) translateY(0);
}

.sheet-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem 0.375rem;
    flex-shrink: 0;
}

.sheet-handle {
    width: 2.25rem;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
}

.sheet-esc-btn {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--foreground-subtle);
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    padding: 0.1875rem 0.5rem;
    cursor: pointer;
    letter-spacing: 0.04em;
    transition: color 0.12s, border-color 0.12s;
    line-height: 1.4;
}

.sheet-esc-btn:hover {
    color: var(--foreground);
    border-color: var(--foreground-subtle);
}

.sheet-frame-body {
    display: block;
    flex: 1;
    overflow-y: auto;
}

/* ─── Bottom nav ─── */

.appnav {
    background-color: var(--background);
    border: 1px solid var(--border);
    border-bottom: none;
    border-top-left-radius: 1.25rem;
    border-top-right-radius: 1.25rem;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: calc(1280px + 3rem);
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 4.5rem;
}

/* Logo pinned to left edge */
.appnav-wordmark {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--foreground);
    flex-shrink: 0;
}

.appnav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.appnav-icon {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    color: var(--foreground-subtle);
    border-radius: 0.5rem;
    transition: color 0.15s;
}

.appnav-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.appnav-icon:hover {
    color: var(--foreground);
}

.appnav-icon.active {
    color: var(--foreground);
}

.appnav-label {
    font-size: 0.625rem;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

.appnav-dot {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background-color: var(--foreground);
}

/* Right edge: search + logout */
.appnav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.appnav-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--foreground-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    transition: color 0.15s;
}

.appnav-icon-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.appnav-icon-btn:hover {
    color: var(--foreground);
}

/* ─── Page content ─── */

.app-main {
    position: relative;
    z-index: 1;
    padding: 5rem 1.5rem 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.app-container {
    flex: 1;
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    background: white;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 0.625rem 0.625rem 0 0;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    padding: 1.5rem 2rem 5rem;
}

.page-placeholder {
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Navbar: demo badge + user dropdown ─────────────────────────────────── */

.appnav-demo-badge {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: hsl(30, 80%, 38%);
    background-color: hsl(38, 100%, 92%);
    border: 1px solid hsl(38, 80%, 78%);
    border-radius: 0.5rem;
    padding: 0.125rem 0.5rem;
    line-height: 1.5;
}

.appnav-user-menu {
    position: relative;
}

.appnav-user-menu summary {
    list-style: none;
}

.appnav-user-menu summary::-webkit-details-marker {
    display: none;
}

.appnav-user-btn {
    display: flex;
    align-items: center;
    gap: 0.3125rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--foreground-muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.3125rem 0.625rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
}

.appnav-user-btn:hover {
    color: var(--foreground);
    border-color: var(--foreground-muted);
}

.appnav-chevron {
    width: 0.875rem;
    height: 0.875rem;
    opacity: 0.6;
    transition: transform 0.15s;
}

.appnav-user-menu[open] .appnav-chevron {
    transform: rotate(180deg);
}

.appnav-dropdown {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.375rem);
    min-width: 11rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    padding: 0.375rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.appnav-dropdown-email {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--foreground-muted);
    padding: 0.375rem 0.5rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.25rem;
    word-break: break-all;
}

.appnav-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    padding: 0.4375rem 0.5rem;
    cursor: pointer;
    transition: background-color 0.1s, color 0.1s;
    color: var(--foreground);
    line-height: 1;
}

.appnav-dropdown-item:hover {
    background-color: var(--background);
}

.appnav-dropdown-item--danger {
    color: hsl(0, 55%, 42%);
}

.appnav-dropdown-item--danger:hover {
    background-color: hsl(0, 60%, 96%);
    color: hsl(0, 55%, 35%);
}
