:root {
    --bg: #0b0f19;
    --panel: rgba(255, 255, 255, 0.06);
    --panel-2: rgba(255, 255, 255, 0.1);
    --text: rgba(255, 255, 255, 0.92);
    --muted: rgba(255, 255, 255, 0.7);
    --border: rgba(255, 255, 255, 0.14);
    --accent: #7c5cff;
    --accent-2: #2de2e6;
    --danger: #ff4d6d;
    --danger-bg: rgba(255, 77, 109, 0.2);
    --success: #31d0aa;
    --success-bg: rgba(49, 208, 170, 0.2);
    --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
    --radius: 18px;
    --radius-sm: 12px;
    --max-width: 1120px;
    --ring: 0 0 0 4px rgba(124, 92, 255, 0.28);
    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

html[data-theme="light"] {
    --bg: #f7f8ff;
    --panel: rgba(0, 0, 0, 0.05);
    --panel-2: rgba(0, 0, 0, 0.08);
    --text: rgba(10, 14, 28, 0.92);
    --muted: rgba(10, 14, 28, 0.66);
    --border: rgba(10, 14, 28, 0.13);
    --danger-bg: rgba(255, 77, 109, 0.14);
    --success-bg: rgba(49, 208, 170, 0.14);
    --shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
    --ring: 0 0 0 4px rgba(124, 92, 255, 0.2);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

html {
    color: var(--text);
    font-family: var(--font-sans);
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    line-height: 1.45;
    background:
        radial-gradient(900px 520px at 18% -10%, rgba(124, 92, 255, 0.3), transparent 55%),
        radial-gradient(900px 520px at 100% 10%, rgba(45, 226, 230, 0.24), transparent 55%),
        radial-gradient(1200px 720px at 50% 125%, rgba(124, 92, 255, 0.2), transparent 60%),
        var(--bg);
}

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

.scrollbar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: 100%;
    height: 3px;
    pointer-events: none;
}

.scrollbar > div {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 14px rgba(45, 226, 230, 0.4);
}

.site-shell {
    min-height: 100vh;
}

.site-nav,
.page-main,
.site-footer {
    width: min(calc(100% - 2rem), var(--max-width));
    margin-inline: auto;
}

.site-header {
    width: 100%;
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 15, 25, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

html[data-theme="light"] .site-header {
    background: rgba(247, 248, 255, 0.74);
}

.site-header__inner {
    width: min(calc(100% - 2rem), var(--max-width));
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
}

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

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 10px 24px rgba(124, 92, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.brand-logo::after {
    content: "";
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), transparent 55%);
    transform: rotate(16deg);
    opacity: 0.64;
}

.brand-copy {
    display: inline-flex;
    flex-direction: column;
    gap: 0.1rem;
}

.brand-title {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-subtitle {
    font-size: 0.78rem;
    color: var(--muted);
}

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

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text);
    padding: 0.58rem 0.78rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.pill:hover {
    transform: translateY(-1px);
    background: var(--panel-2);
}

.pill:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.kbd {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.1rem 0.35rem;
    font-size: 0.72rem;
    color: var(--muted);
    background: var(--panel);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.9rem 0 1.15rem;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    color: var(--text);
    padding: 0.58rem 0.9rem;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.site-nav a.is-active,
.site-nav a:hover,
.site-nav a:focus-visible {
    background: rgba(124, 92, 255, 0.24);
    border-color: rgba(124, 92, 255, 0.62);
    transform: translateY(-1px);
    outline: none;
}

.flash,
.inline-message {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--panel);
    padding: 0.8rem 0.9rem;
}

.flash--success,
.inline-message--success {
    border-color: rgba(49, 208, 170, 0.45);
    background: var(--success-bg);
    color: var(--success);
}

.flash--error,
.inline-message--error {
    border-color: rgba(255, 77, 109, 0.45);
    background: var(--danger-bg);
    color: var(--danger);
}

.toast-stack {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 95;
    display: grid;
    gap: 0.6rem;
    width: min(92vw, 420px);
    pointer-events: none;
}

.toast {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.7rem;
    align-items: start;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(11, 15, 25, 0.96);
    box-shadow: var(--shadow);
    padding: 0.74rem 0.86rem;
    pointer-events: auto;
    animation: toast-in 0.2s ease;
}

html[data-theme="light"] .toast {
    background: rgba(247, 248, 255, 0.98);
}

.toast--success {
    border-color: rgba(49, 208, 170, 0.45);
}

.toast--error {
    border-color: rgba(255, 77, 109, 0.45);
}

.toast--info {
    border-color: rgba(45, 226, 230, 0.45);
}

.toast__message {
    margin: 0;
}

.toast__close {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 0.78rem;
    padding: 0.2rem 0.55rem;
}

.toast__close:hover,
.toast__close:focus-visible {
    background: var(--panel-2);
    color: var(--text);
    outline: none;
}

.toast--closing {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr);
    gap: 1rem;
    align-items: start;
}

.search-main,
.search-side {
    display: grid;
    gap: 1rem;
}

.results-meta {
    margin: 0;
}

.basket-summary {
    display: grid;
    gap: 0.9rem;
}

.basket-summary__list {
    display: grid;
    gap: 0.7rem;
}

.basket-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    padding: 0.72rem;
    display: grid;
    gap: 0.55rem;
}

.basket-item__title {
    font-weight: 600;
}

.basket-item__meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.basket-item__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.basket-item__actions form {
    display: block;
}

.basket-item__actions .button {
    min-width: 90px;
    padding: 0.45rem 0.7rem;
}

.basket-item__actions .button--small {
    min-width: 54px;
}

.page-main {
    display: grid;
    gap: 1.2rem;
    padding-bottom: 2.8rem;
}

.panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: clamp(1rem, 2.2vw, 1.45rem);
}

.hero-panel {
    padding: clamp(1.25rem, 4vw, 2.3rem);
}

.hero-panel h1,
.form-panel h1,
.notice-panel h1,
.panel h1,
.panel h2 {
    margin-top: 0;
    letter-spacing: -0.02em;
}

.panel h1 {
    margin-bottom: 0.8rem;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.9rem;
    padding: 0.28rem 0.62rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--panel-2);
}

.grid,
.detail-grid,
.user-cards {
    display: grid;
    gap: 1rem;
}

.grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.detail-label {
    display: block;
    margin-bottom: 0.32rem;
    color: var(--muted);
    font-size: 0.82rem;
}

.button-row,
.helper-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.68rem;
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 154px;
    width: fit-content;
    border: 1px solid rgba(124, 92, 255, 0.55);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.42), rgba(45, 226, 230, 0.18));
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    padding: 0.7rem 1rem;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button:hover,
button.button:hover {
    transform: translateY(-1px);
    border-color: rgba(124, 92, 255, 0.85);
}

.button:focus-visible,
button.button:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

.button--secondary {
    border-color: var(--border);
    background: var(--panel-2);
}

.button:disabled,
button.button:disabled {
    opacity: 0.58;
    cursor: not-allowed;
    transform: none;
}

form,
.stack-form {
    display: grid;
    gap: 0.85rem;
}

label {
    display: block;
    font-size: 0.84rem;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    padding: 0.68rem 0.78rem;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    box-shadow: var(--ring);
    border-color: rgba(124, 92, 255, 0.68);
    background: var(--panel);
}

input[readonly] {
    opacity: 0.86;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
}

.checkbox-row input {
    width: auto;
    margin: 0;
}

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

.predictive-wrap {
    display: grid;
    gap: 0.45rem;
}

.predictive-results {
    margin: 0;
    padding: 0.45rem;
    list-style: none;
    display: grid;
    gap: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel);
    box-shadow: var(--shadow);
    max-height: 250px;
    overflow: auto;
}

.predictive-note {
    padding: 0.5rem 0.55rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.predictive-option {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-2);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font: inherit;
    padding: 0.56rem 0.62rem;
    transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.predictive-option:hover,
.predictive-option:focus-visible {
    outline: none;
    border-color: rgba(124, 92, 255, 0.7);
    background: rgba(124, 92, 255, 0.2);
    transform: translateY(-1px);
}

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 0.93rem;
}

table[border] {
    border: 1px solid var(--border);
}

thead th {
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--muted);
    font-weight: 600;
    letter-spacing: 0.02em;
}

th,
td {
    padding: 0.68rem 0.62rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tbody tr:hover {
    background: rgba(124, 92, 255, 0.08);
}

.card-thumb {
    display: block;
    width: 110px;
    height: 154px;
    border: 1px solid var(--border);
    border-radius: 10px;
    object-fit: cover;
    background: var(--panel-2);
}

.card-thumb-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
    border-radius: 10px;
}

.card-thumb-wrap:focus {
    outline: none;
    box-shadow: var(--ring);
}

.card-thumb-hover {
    position: absolute;
    top: -4px;
    left: calc(100% + 12px);
    z-index: 30;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}

.card-thumb-full {
    display: block;
    width: 244px;
    height: 340px;
    border: 1px solid var(--border);
    border-radius: 12px;
    object-fit: cover;
    background: var(--panel-2);
    box-shadow: var(--shadow);
}

.card-thumb-wrap:hover .card-thumb-hover,
.card-thumb-wrap:focus .card-thumb-hover,
.card-thumb-wrap:focus-within .card-thumb-hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-card {
    display: grid;
    gap: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel-2);
    padding: 1rem;
}

.user-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
}

.user-card__header h2 {
    margin: 0;
}

.role-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel);
    padding: 0.3rem 0.62rem;
    font-size: 0.8rem;
}

.inline-form {
    display: block;
}

.site-footer {
    border-top: 1px solid var(--border);
    color: var(--muted);
    margin-top: 1.6rem;
    padding: 1.2rem 0 2rem;
}

@media (max-width: 900px) {
    .site-nav,
    .page-main,
    .site-footer {
        width: min(calc(100% - 1rem), var(--max-width));
    }

    .site-header__inner {
        width: min(calc(100% - 1rem), var(--max-width));
        padding: 0.68rem 0;
    }

    .brand-title {
        font-size: 0.96rem;
    }

    .brand-subtitle {
        font-size: 0.72rem;
    }

    .site-nav a,
    .button,
    button.button {
        width: 100%;
    }

    .search-workspace {
        grid-template-columns: 1fr;
    }

    .toast-stack {
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
    }

    .user-card__header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
