@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    --bg: #090f17;
    --bg-soft: #101927;
    --panel: rgba(12, 21, 34, 0.84);
    --panel-strong: #0f1d2e;
    --line: rgba(157, 189, 220, 0.22);
    --line-strong: rgba(111, 173, 238, 0.48);
    --text: #edf4ff;
    --muted: #9cb5d2;
    --accent: #12b5ff;
    --accent-2: #f4b740;
    --danger: #fda4af;
    --danger-bg: rgba(252, 165, 165, 0.14);
    --success: #86efac;
    --success-bg: rgba(110, 231, 183, 0.14);
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(42rem 22rem at 12% -8%, rgba(18, 181, 255, 0.09), transparent 72%),
        linear-gradient(180deg, #081019 0%, #0a1119 100%);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(circle at 50% 25%, #000 35%, transparent 85%);
    opacity: 0.1;
}

a {
    color: inherit;
}

.topbar {
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
    background: rgba(5, 12, 19, 0.62);
}

.topbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.15rem 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.brand-block h1,
.login-card h1,
.request-card h1 {
    margin: 0;
    font-size: clamp(1.18rem, 2vw, 1.55rem);
    letter-spacing: 0.02em;
}

.brand-block p,
.lead {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.lead {
    margin-bottom: 1rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.nav-link,
.logout {
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    color: #e2f1ff;
}

.nav-link:hover,
.logout:hover {
    border-color: var(--accent);
    color: #ffffff;
}

.user {
    color: var(--muted);
    font-size: 0.92rem;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.8rem 1rem 2.4rem;
}

.page-main-center {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
}

.dashboard-shell {
    display: grid;
    gap: 1rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 0.95rem;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.panel {
    display: grid;
    gap: 0.8rem;
}

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

.request-choice-actions {
    display: grid;
    gap: 0.7rem;
}

.request-choice-button {
    width: 100%;
    justify-content: center;
}

.request-choice-secondary {
    gap: 0.55rem;
}

.request-choice-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.request-choice-divider::before,
.request-choice-divider::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: rgba(157, 189, 220, 0.18);
}

.section-head {
    margin-bottom: 0.75rem;
}

.section-head h2 {
    margin: 0;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: #d2e7ff;
}

.section-head-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.section-head-actions {
    display: flex;
    justify-content: flex-end;
    align-self: flex-end;
}

.section-head p,
.helper-text,
.request-meta,
.artifact-card p,
.approval-item p {
    color: var(--muted);
    font-size: 0.92rem;
}

.section-head.section-head-row p {
    margin-bottom: 0;
}

.request-meta {
    margin: 1rem 0;
}

.upload-form,
.stack-form,
.artifact-list,
.approval-list {
    display: grid;
    gap: 0.8rem;
}

.upload-form-hidden {
    display: none;
}

.field-grid {
    display: grid;
    gap: 0.45rem;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #b9d5f4;
}

input[type='text'],
input[type='email'],
input[type='file'],
.link-input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.68rem;
    background: #0a1727;
    color: var(--text);
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, monospace;
    font-size: 0.9rem;
    line-height: 1.3;
    padding: 0.78rem 0.8rem;
}

input[type='file'] {
    padding: 0.7rem 0.8rem;
}

input::placeholder {
    color: #6f87a5;
}

input:focus {
    outline: 2px solid rgba(18, 181, 255, 0.35);
    border-color: rgba(18, 181, 255, 0.65);
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 42px;
    border: 1px solid rgba(18, 181, 255, 0.45);
    border-radius: 0.65rem;
    background: linear-gradient(135deg, rgba(17, 173, 250, 0.22), rgba(16, 120, 193, 0.28));
    color: #f5fbff;
    font: 600 0.85rem/1 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', sans-serif;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0 0.88rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.button:hover {
    transform: translateY(-1px);
    border-color: rgba(18, 181, 255, 0.75);
    background: linear-gradient(135deg, rgba(17, 173, 250, 0.36), rgba(16, 120, 193, 0.42));
}

.button:disabled,
.button[aria-disabled='true'] {
    opacity: 0.5;
    cursor: default;
    transform: none;
    pointer-events: none;
}

.button-subtle {
    border-color: rgba(157, 189, 220, 0.34);
    background: rgba(157, 189, 220, 0.12);
}

.button-compact {
    min-height: 34px;
    padding: 0 0.72rem;
    font-size: 0.77rem;
}

.button-success {
    border-color: rgba(110, 231, 183, 0.42);
    background: rgba(110, 231, 183, 0.16);
}

.button-success:hover {
    border-color: rgba(110, 231, 183, 0.7);
    background: rgba(110, 231, 183, 0.24);
}

.button-danger {
    border-color: rgba(253, 164, 175, 0.44);
    background: rgba(253, 164, 175, 0.12);
}

.button-danger:hover {
    border-color: rgba(253, 164, 175, 0.7);
    background: rgba(253, 164, 175, 0.2);
}

.google-button {
    width: 100%;
    gap: 0.7rem;
    margin-top: 1rem;
}

.login-card .google-button {
    margin-top: 0;
}

.google-icon {
    width: 1rem;
    height: 1rem;
}

.notice {
    margin: 1rem 0;
    border-radius: 0.8rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--line);
}

.notice-flush {
    margin: 0;
}

.notice.error {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: rgba(253, 164, 175, 0.3);
}

.notice.success {
    color: var(--success);
    background: var(--success-bg);
    border-color: rgba(110, 231, 183, 0.3);
}

.artifact-card,
.approval-item {
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    background: rgba(10, 20, 33, 0.72);
    padding: 0.95rem;
}

.artifact-head,
.approval-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.artifact-card h3,
.approval-item h3 {
    margin: 0;
    font-size: 1.02rem;
}

.artifact-title {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.artifact-title-link {
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.artifact-title-link:hover {
    text-decoration: underline;
}

.artifact-title-size {
    color: var(--muted);
    font-size: 0.84rem;
}

.artifact-delete-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--danger);
    font: inherit;
    font-size: 0.84rem;
    cursor: pointer;
    text-decoration: none;
}

.artifact-delete-link:hover {
    text-decoration: underline;
}

.artifact-title-block {
    display: grid;
    gap: 0.2rem;
}

.artifact-meta-line {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.artifact-head-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.artifact-owner-actions {
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
    .artifact-delete-link {
        visibility: hidden;
        pointer-events: none;
    }

    .artifact-card:hover .artifact-delete-link,
    .artifact-card:focus-within .artifact-delete-link {
        visibility: visible;
        pointer-events: auto;
    }
}

.artifact-date {
    color: var(--muted);
    font-size: 0.84rem;
}

.link-row,
.action-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    margin-top: 0.9rem;
}

.action-row {
    flex-wrap: wrap;
}

.link-field {
    position: relative;
    flex: 1 1 320px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.icon-mark.is-hidden {
    display: none;
}

.action-row-tight {
    margin-top: 0;
}

.link-input {
    padding-right: 4rem;
}

.link-copy-button {
    position: absolute;
    right: 0.35rem;
    top: 0.35rem;
    bottom: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    min-height: 0;
    border: 1px solid rgba(18, 181, 255, 0.24);
    border-radius: 0.55rem;
    background: #12253a;
    color: #9ec8ef;
    padding: 0;
    cursor: pointer;
    line-height: 1;
}

.link-copy-button:hover {
    border-color: rgba(18, 181, 255, 0.44);
    background: #17314b;
    color: #e2f3ff;
}

.link-copy-button:focus-visible {
    outline: 2px solid rgba(18, 181, 255, 0.35);
    outline-offset: 1px;
}

.link-copy-button svg {
    width: 0.95rem;
    height: 0.95rem;
    transform: translateY(1px);
}

.access-popover {
    position: relative;
}

.access-popover summary {
    list-style: none;
}

.access-popover summary::-webkit-details-marker {
    display: none;
}

.access-popover-toggle {
    gap: 0.45rem;
    border-color: rgba(157, 189, 220, 0.22);
    background: rgba(12, 23, 36, 0.68);
    color: #d6e7f8;
    padding-left: 0.82rem;
    padding-right: 0.74rem;
}

.access-popover-meta {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.access-popover[open] .access-popover-toggle {
    border-color: rgba(111, 173, 238, 0.42);
    background: rgba(18, 32, 49, 0.92);
}

.access-popover-toggle:hover {
    border-color: rgba(157, 189, 220, 0.34);
    background: rgba(16, 29, 44, 0.84);
}

.access-popover-count,
.access-popover-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.18rem 0.48rem;
    font-size: 0.72rem;
    line-height: 1;
}

.access-popover-count {
    background: rgba(157, 189, 220, 0.16);
    color: #e8f4ff;
}

.access-popover-badge {
    background: rgba(17, 173, 250, 0.2);
    color: #cdefff;
}

.access-popover-status {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.access-popover-chevron {
    color: #88a7c6;
    font-size: 0.78rem;
    line-height: 1;
    transform: translateY(-1px);
}

.access-popover-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.65rem);
    z-index: 20;
    width: min(32rem, calc(100vw - 2rem));
    display: grid;
    gap: 0.9rem;
    padding: 0.95rem;
    border: 1px solid rgba(157, 189, 220, 0.24);
    border-radius: 0.95rem;
    background: rgba(8, 16, 27, 0.96);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
}

.access-popover-section {
    display: grid;
    gap: 0.7rem;
}

.access-popover-section + .access-popover-section {
    padding-top: 0.9rem;
    border-top: 1px solid rgba(157, 189, 220, 0.14);
}

.access-popover-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.access-popover-section-head h4 {
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #d2e7ff;
}

.access-popover-section-head span {
    color: var(--muted);
    font-size: 0.78rem;
}

.access-popover-list {
    display: grid;
    gap: 0.65rem;
}

.access-popover-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    border: 1px solid rgba(157, 189, 220, 0.14);
    border-radius: 0.8rem;
    background: rgba(13, 24, 38, 0.9);
    padding: 0.72rem 0.75rem;
}

.access-popover-item .action-row {
    margin-top: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.access-popover-item .button-compact {
    flex: 0 0 auto;
}

.access-popover-copy {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    gap: 0.18rem;
}

.access-popover-copy strong {
    font-size: 0.92rem;
}

.access-popover-copy span,
.access-popover-empty {
    color: var(--muted);
    font-size: 0.82rem;
}

.access-popover-empty {
    margin: 0;
}

.inline-form {
    margin: 0;
}

.empty-state {
    color: var(--muted);
    margin: 0.25rem 0 0;
}

@media (max-width: 720px) {
    .topbar-inner,
    .artifact-head,
    .approval-item,
    .access-popover-item,
    .link-row,
    .action-row {
        flex-direction: column;
        align-items: stretch;
    }

    .artifact-meta {
        text-align: left;
    }

    .nav-link,
    .logout {
        text-align: center;
    }

    .section-head-row,
    .section-head-actions {
        align-items: stretch;
        justify-content: stretch;
    }

    .artifact-head-actions {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        gap: 0.6rem;
        width: 100%;
    }

    .artifact-head-actions > .button,
    .artifact-head-actions > .access-popover,
    .artifact-head-actions > .access-popover > summary {
        width: 100%;
    }

    .artifact-head-actions > .access-popover {
        flex: 1.35 1 0;
        min-width: 0;
    }

    .artifact-head-actions > .button {
        flex: 0.85 1 0;
        min-width: 0;
    }

    .link-field {
        flex: 0 1 auto;
    }

    .access-popover-toggle {
        justify-content: space-between;
    }

    .access-popover {
        width: 100%;
    }

    .access-popover[open] {
        flex-basis: 100%;
    }

    .access-popover-panel {
        position: static;
        margin-top: 0.65rem;
        left: auto;
        right: auto;
        width: auto;
        box-shadow: none;
    }

    .access-popover-item .action-row {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: nowrap;
    }
}
