:root {
    --color-text: #477B8E;
    --color-text-muted: rgba(71, 123, 142, 0.78);
    --color-surface: #F2F2F2;
    --color-page: #f7f7f5;
    --color-border: #c5d5dc;
    --color-border-strong: #a8c4cf;
    --color-danger: #8b4a4a;
    --color-danger-hover: #a85a5a;
    --color-primary-hover: #5a94a8;
    --color-input-text: #020202;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;
    --space-xl: 1.5rem;
    --space-2xl: 2rem;
    --space-3xl: 2.5rem;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px;

    --auth-card-bg: rgba(255, 255, 255, 0.94);
    --auth-shadow: 0 12px 40px rgba(71, 123, 142, 0.14);
    --auth-shadow-hover: 0 16px 48px rgba(71, 123, 142, 0.18);

    --app-card-bg: rgba(255, 255, 255, 0.94);
    --app-shadow: 0 8px 32px rgba(71, 123, 142, 0.1);
    --app-shadow-hover: 0 12px 40px rgba(71, 123, 142, 0.14);

    --content-max: 80rem;
    --sidebar-width: 18rem;
    --workspace-min: 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    background-color: var(--color-page);
    background-image: url(/paper.png);
    color: var(--color-text);
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: 'Merriweather', serif;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.65;
}

body {
    padding: var(--space-2xl) var(--space-xl);
}

@media only screen and (max-width: 600px) {
    body {
        padding: var(--space-lg) var(--space-md);
    }
}

h1 {
    font-family: 'Antonio', sans-serif;
    font-weight: 100;
    font-size: clamp(2.5rem, 6vw, 3.75rem);
    line-height: 1.1;
    letter-spacing: 0.04em;
    margin: 0 0 var(--space-md);
}

h2 {
    font-family: 'Antonio', sans-serif;
    font-weight: 100;
    font-size: 1.5rem;
    line-height: 1.25;
    margin: 0 0 var(--space-md);
}

h3 {
    font-family: 'Antonio', sans-serif;
    font-weight: 100;
    font-size: 1.1rem;
    line-height: 1.3;
    margin: 0 0 var(--space-sm);
    letter-spacing: 0.02em;
}

p {
    margin: 0 0 var(--space-lg);
}

p:last-child {
    margin-bottom: 0;
}

@media screen {
    body:not(.auth-page) :is(h1, h2, h3, h4, h5, h6, p, label):not(:where(.app-header *, .auth-invite-dialog *)) {
        background-image: url('/distressed.png');
        background-clip: text;
        -webkit-background-clip: text;
        background-size: cover;
        background-repeat: repeat;
        text-fill-color: transparent;
        -webkit-text-fill-color: transparent;
    }

    input, select, textarea, button, .badge-super, .json-preview, .form-error, .hint, .muted, code, a {
        text-fill-color: initial;
        -webkit-text-fill-color: initial;
    }

    .sidebar a,
    .module-link,
    .form-actions a,
    .page-hero a,
    .workspace-empty h2,
    .sidebar-label,
    .editor h2,
    .editor h3,
    .editor ul a,
    .admin-user-link {
        -webkit-text-fill-color: var(--color-text);
        text-fill-color: var(--color-text);
    }

    .app-header .app-header__wordmark,
    .app-header .app-header__tagline {
        background-image: none;
        color: #ffffff;
        -webkit-text-fill-color: #ffffff;
        text-fill-color: #ffffff;
    }

    .app-header .app-header__user,
    .app-header .app-header__signout {
        -webkit-text-fill-color: #ffffff;
        text-fill-color: #ffffff;
    }
}

essay {
    display: block;
    margin: 0 auto;
    column-count: 2;
    column-width: 14em;
    column-gap: 4em;
    padding-bottom: var(--space-3xl);
    max-width: 60rem;
}

content {
    margin: 0 auto;
    width: 100%;
    max-width: var(--content-max);
    display: block;
}

/* ─── Page chrome ─────────────────────────────────────── */

.page-hero {
    text-align: center;
    margin-bottom: var(--space-2xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
}

.page-hero--compact {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
}

.page-hero--compact h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin-bottom: var(--space-sm);
}

.page-hero .tagline {
    font-size: 1.05rem;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.page-hero .session-hint {
    margin-top: var(--space-md);
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* ─── Auth / sign-in ──────────────────────────────────── */

body.auth-page {
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(18rem, 1.05fr) minmax(20rem, 0.95fr);
    min-height: 100vh;
    width: 100%;
}

@media only screen and (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        min-height: 100dvh;
    }

    .auth-brand {
        padding: 2rem 1.5rem 1.75rem;
    }

    .auth-brand .auth-wordmark {
        font-size: 2.25rem;
        margin-bottom: var(--space-md);
    }

    .auth-brand .auth-tagline {
        margin-bottom: var(--space-lg);
        font-size: 0.95rem;
    }

    .auth-features {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-sm) var(--space-lg);
    }

    .auth-features li::before {
        display: none;
    }

    .auth-form-panel {
        padding: 1.5rem 1.25rem 2rem;
        justify-content: flex-start;
    }
}

.auth-brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2.5rem, 6vw, 4.5rem);
    background-color: var(--color-text);
    background-image:
        linear-gradient(145deg, rgba(71, 123, 142, 0.92) 0%, rgba(55, 98, 112, 0.96) 55%, rgba(42, 78, 90, 0.98) 100%),
        url(/paper.png);
    background-blend-mode: multiply, normal;
    background-size: cover, 420px;
    color: #f7f7f5;
    overflow: hidden;
}

.auth-brand--compact {
    padding: clamp(2rem, 5vw, 3rem);
}

.auth-brand--compact .auth-tagline,
.auth-brand--compact .auth-features {
    display: none;
}

.auth-brand__glow {
    position: absolute;
    inset: -20% -10% auto auto;
    width: min(28rem, 70vw);
    height: min(28rem, 70vw);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.14) 0%, transparent 68%);
    pointer-events: none;
}

.auth-brand__inner {
    position: relative;
    z-index: 1;
    max-width: 26rem;
    animation: auth-rise 0.7s ease both;
}

.auth-wordmark {
    margin: 0 0 var(--space-lg);
    font-family: 'Antonio', sans-serif;
    font-weight: 100;
    font-size: clamp(2.75rem, 7vw, 4rem);
    line-height: 1.05;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    -webkit-text-fill-color: #f7f7f5;
    text-fill-color: #f7f7f5;
}

.auth-tagline {
    margin: 0 0 var(--space-2xl);
    font-family: 'Merriweather', serif;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.7;
    opacity: 0.92;
    -webkit-text-fill-color: #f7f7f5;
    text-fill-color: #f7f7f5;
}

.auth-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    font-family: 'Antonio', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    opacity: 0.88;
    -webkit-text-fill-color: #f7f7f5;
    text-fill-color: #f7f7f5;
}

.auth-features li::before {
    content: "";
    width: 1.5rem;
    height: 1px;
    background: rgba(247, 247, 245, 0.55);
    flex-shrink: 0;
}

.auth-form-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    padding: clamp(2rem, 5vw, 3.5rem);
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(71, 123, 142, 0.06), transparent 70%),
        var(--color-page) url(/paper.png);
    background-size: auto, 420px;
}

.auth-card {
    width: min(26rem, 100%);
    padding: clamp(1.75rem, 4vw, 2.5rem);
    background: var(--auth-card-bg);
    border: 1px solid rgba(197, 213, 220, 0.85);
    border-radius: var(--radius-lg);
    box-shadow: var(--auth-shadow);
    backdrop-filter: blur(8px);
    animation: auth-rise 0.7s ease 0.1s both;
}

.auth-card__header {
    margin-bottom: var(--space-xl);
}

.auth-card__title {
    margin: 0 0 var(--space-sm);
    font-family: 'Antonio', sans-serif;
    font-weight: 500;
    font-size: 1.85rem;
    letter-spacing: 0.04em;
    color: var(--color-text);
}

.auth-card__subtitle {
    margin: 0;
    font-family: 'Merriweather', serif;
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--color-text-muted);
}

.auth-alert {
    margin-bottom: var(--space-lg);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(139, 74, 74, 0.35);
    background: rgba(139, 74, 74, 0.08);
    color: var(--color-danger);
    font-family: 'Merriweather', serif;
    font-size: 0.92rem;
    line-height: 1.5;
    -webkit-text-fill-color: var(--color-danger);
    text-fill-color: var(--color-danger);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.auth-field label {
    display: block;
    margin-bottom: var(--space-sm);
    font-family: 'Antonio', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text);
}

.auth-field input {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--color-input-text);
    font-family: 'Merriweather', serif;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.auth-field input:hover {
    border-color: var(--color-border-strong);
}

.auth-field input:focus {
    outline: none;
    border-color: var(--color-text);
    box-shadow: 0 0 0 3px rgba(71, 123, 142, 0.14);
}

.auth-submit {
    width: 100%;
    margin-top: var(--space-sm);
    padding: 0.85rem 1.5rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #5a94a8 0%, var(--color-text) 100%);
    color: #f7f7f5;
    font-family: 'Antonio', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.auth-submit:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 6px 20px rgba(71, 123, 142, 0.25);
    transform: translateY(-1px);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-signup {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(197, 213, 220, 0.6);
}

.auth-secondary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.65);
    color: var(--color-text);
    font-family: 'Antonio', sans-serif;
    font-size: 0.95rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.auth-secondary:hover {
    background: #fff;
    border-color: var(--color-text);
}

.auth-invite-dialog {
    width: min(22rem, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
    margin: 0;
    padding: var(--space-2xl);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--auth-card-bg);
    box-shadow: var(--auth-shadow-hover);
    color: var(--color-text);
}

.auth-invite-dialog:not([open]) {
    display: none;
}

.auth-invite-dialog[open] {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.auth-invite-dialog::backdrop {
    background: rgba(42, 78, 90, 0.4);
}

.auth-invite-dialog__title {
    margin: 0 0 var(--space-md);
    font-family: 'Antonio', sans-serif;
    font-weight: 500;
    font-size: 1.35rem;
    letter-spacing: 0.04em;
    color: var(--color-text);
}

.auth-invite-dialog__text {
    margin: 0 0 var(--space-xl);
    font-family: 'Merriweather', serif;
    font-weight: 300;
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--color-text-muted);
}

.auth-invite-dialog__text a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.auth-invite-dialog__text a:hover {
    color: var(--color-primary-hover);
}

.auth-invite-dialog__close {
    margin-top: 0;
}

.auth-hint {
    margin: var(--space-xl) 0 0;
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(197, 213, 220, 0.6);
    font-family: 'Merriweather', serif;
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--color-text-muted);
    -webkit-text-fill-color: var(--color-text-muted);
    text-fill-color: var(--color-text-muted);
}

.auth-hint code {
    font-size: 0.9em;
}

.auth-footer {
    margin: 0;
    font-family: 'Antonio', sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    opacity: 0.75;
    -webkit-text-fill-color: var(--color-text-muted);
    text-fill-color: var(--color-text-muted);
    animation: auth-rise 0.7s ease 0.2s both;
}

@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand__inner,
    .auth-card,
    .auth-footer {
        animation: none;
    }

    .auth-submit:hover {
        transform: none;
    }
}

/* warning panels */
warning {
    color: var(--color-text);
    display: block;
    width: min(28rem, 100%);
    margin: 0;
    padding: var(--space-2xl);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 12px rgba(71, 123, 142, 0.08);
    -webkit-text-fill-color: initial;
    text-fill-color: initial;
    font-family: 'Antonio', sans-serif;
}

warning h2 {
    margin-bottom: var(--space-lg);
}

warning label,
.editor label {
    display: block;
    margin: 0 0 var(--space-lg);
    text-align: left;
    font-family: 'Antonio', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text);
}

warning input[type="text"],
warning input[type="password"],
warning input[type="number"],
warning input[type="url"],
warning textarea,
warning select,
.editor input,
.editor textarea,
.editor select {
    display: block;
    width: 100%;
    margin-top: var(--space-sm);
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--color-input-text);
    font-family: 'Merriweather', serif;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

warning input:focus,
warning textarea:focus,
warning select:focus,
.editor input:focus,
.editor textarea:focus,
.editor select:focus {
    outline: none;
    border-color: var(--color-text);
    box-shadow: 0 0 0 2px rgba(71, 123, 142, 0.15);
}

warning textarea,
.editor textarea {
    min-height: 5rem;
    resize: vertical;
}

warning button,
.editor button:not(.btn-ghost):not(.app-header__signout),
.link-btn {
    margin-top: var(--space-sm);
    padding: 0.6rem 1.35rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, #5a94a8 0%, var(--color-text) 100%);
    color: #f7f7f5;
    font-family: 'Antonio', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

warning button:hover,
.editor button:not(.btn-ghost):not(.app-header__signout):hover,
.link-btn:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 16px rgba(71, 123, 142, 0.2);
    transform: translateY(-1px);
}

button.danger {
    background: var(--color-danger);
}

button.danger:hover {
    background: var(--color-danger-hover);
}

.form-error {
    color: var(--color-danger);
    margin-bottom: var(--space-md);
    font-size: 0.95rem;
}

.hint, .muted {
    font-size: 0.875rem;
    line-height: 1.5;
    opacity: 0.9;
    color: var(--color-text-muted);
}

code {
    font-family: monospace;
    font-size: 0.88em;
    padding: 0.1em 0.35em;
    background: rgba(242, 242, 242, 0.9);
    border-radius: 2px;
}

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

body.app-page {
    padding: 0;
    min-height: 100vh;
}

.app-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg) var(--space-xl);
    padding: var(--space-lg) clamp(1.25rem, 4vw, 2.5rem);
    background-color: var(--color-text);
    background-image:
        linear-gradient(145deg, rgba(71, 123, 142, 0.92) 0%, rgba(55, 98, 112, 0.96) 55%, rgba(42, 78, 90, 0.98) 100%),
        url(/paper.png);
    background-blend-mode: multiply, normal;
    background-size: cover, 420px;
    color: #f7f7f5;
    box-shadow: 0 4px 24px rgba(42, 78, 90, 0.18);
}

.app-header__brand {
    min-width: 0;
}

.app-header .app-header__wordmark {
    display: inline-block;
    font-family: 'Antonio', sans-serif;
    font-weight: 100;
    font-size: clamp(1.5rem, 4vw, 2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: #ffffff;
    line-height: 1.1;
    background-image: none;
    background-clip: border-box;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: #ffffff;
    text-fill-color: #ffffff;
}

.app-header__wordmark:hover {
    opacity: 0.92;
}

.app-header .app-header__tagline {
    margin: var(--space-xs) 0 0;
    font-family: 'Merriweather', serif;
    font-weight: 300;
    font-size: 0.88rem;
    color: #ffffff;
    opacity: 0.92;
    background-image: none;
    background-clip: border-box;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: #ffffff;
    text-fill-color: #ffffff;
}

.app-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-md) var(--space-lg);
}

.app-header__user {
    font-family: 'Merriweather', serif;
    font-size: 0.9rem;
    opacity: 0.92;
    color: #f7f7f5;
}

.app-header__signout {
    margin: 0;
    padding: 0.45rem 1rem;
    border: 1px solid rgba(247, 247, 245, 0.45);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: #f7f7f5;
    font-family: 'Antonio', sans-serif;
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.app-header__signout:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(247, 247, 245, 0.7);
}

.app-content {
    padding: var(--space-xl) clamp(1rem, 3vw, 2rem) var(--space-3xl);
}

.link-btn {
    margin-top: 0;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}

/* ─── App layout ────────────────────────────────────────── */

.app-grid {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(var(--workspace-min), 1fr);
    gap: var(--space-xl);
    align-items: start;
    max-width: var(--content-max);
    margin: 0 auto;
}

@media only screen and (max-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
}

.sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--space-lg);
    padding: var(--space-lg);
    background: var(--app-card-bg);
    border: 1px solid rgba(197, 213, 220, 0.85);
    border-radius: var(--radius-lg);
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(8px);
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
}

@media only screen and (max-width: 900px) {
    .sidebar {
        position: static;
        max-height: none;
    }
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(197, 213, 220, 0.65);
}

.sidebar-panel {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(197, 213, 220, 0.65);
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: var(--space-lg);
}

.sidebar-label {
    margin: 0;
    font-family: 'Antonio', sans-serif;
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.module-link {
    display: block;
    padding: 0.55rem 0.75rem;
    color: var(--color-text);
    text-decoration: none;
    font-family: 'Antonio', sans-serif;
    font-size: 0.92rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.module-link:hover {
    background: rgba(71, 123, 142, 0.06);
    border-color: var(--color-border);
}

.module-link.is-active {
    background: linear-gradient(180deg, rgba(90, 148, 168, 0.14) 0%, rgba(71, 123, 142, 0.1) 100%);
    border-color: var(--color-border-strong);
    font-weight: 500;
}

.sidebar-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.btn-ghost {
    margin: 0;
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.7);
    color: var(--color-text);
    font-family: 'Antonio', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-ghost:hover {
    background: #fff;
    border-color: var(--color-text);
}

.sidebar-search input,
.search input {
    width: 100%;
    margin-bottom: var(--space-sm);
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: 'Merriweather', serif;
    font-size: 0.88rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-search input:focus,
.search input:focus {
    outline: none;
    border-color: var(--color-text);
    box-shadow: 0 0 0 2px rgba(71, 123, 142, 0.12);
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-list li {
    margin: 0;
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius-sm);
    border-bottom: 1px solid rgba(197, 213, 220, 0.35);
    transition: background 0.15s ease;
}

.sidebar-list li:last-child {
    border-bottom: 0;
}

.sidebar-list li:hover {
    background: rgba(71, 123, 142, 0.05);
}

.sidebar-list li a {
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.45;
}

.sidebar-list li a:hover {
    text-decoration: underline;
}

.sidebar-admin {
    padding: var(--space-md) 0 var(--space-md) var(--space-md);
    border-left: 3px solid var(--color-text);
    background: rgba(71, 123, 142, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-admin .muted {
    margin: var(--space-xs) 0 0;
    font-size: 0.78rem;
}

#workspace,
.workspace {
    min-width: 0;
}

.workspace {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.editor {
    width: 100%;
    max-width: 48rem;
    padding: clamp(1.25rem, 3vw, 2rem) clamp(1.5rem, 3vw, 2.25rem);
    background: var(--app-card-bg);
    border: 1px solid rgba(197, 213, 220, 0.85);
    border-radius: var(--radius-lg);
    box-shadow: var(--app-shadow);
    backdrop-filter: blur(8px);
}

.workspace .editor {
    max-width: none;
}

.editor + .editor {
    margin-top: 0;
}

.editor h2 {
    margin: 0 0 var(--space-sm);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid rgba(197, 213, 220, 0.65);
    font-weight: 500;
    font-size: 1.65rem;
    letter-spacing: 0.03em;
    color: var(--color-text);
}

.editor h3 {
    margin-top: var(--space-xl);
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--color-text);
}

.editor > p.muted:first-of-type,
.editor > p:first-of-type.muted {
    margin-top: 0;
    margin-bottom: var(--space-xl);
    font-size: 0.95rem;
    line-height: 1.6;
}

.editor ul,
.editor ol {
    margin: var(--space-md) 0 var(--space-lg);
    padding-left: 1.35rem;
}

.editor ul li {
    margin: var(--space-sm) 0;
    line-height: 1.55;
    padding: 0.2rem 0;
}

.editor ol li {
    margin: var(--space-md) 0;
    line-height: 1.55;
    padding: 0.35rem 0;
}

.editor ol li a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 400;
}

.editor ol li a:hover {
    text-decoration: underline;
}

.editor > button:not(.danger) {
    margin-right: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.form-actions a {
    color: var(--color-text);
    font-family: 'Antonio', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}

.badge-super {
    font-family: 'Antonio', sans-serif;
    font-size: 0.8rem;
    background: var(--color-surface);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    -webkit-text-fill-color: var(--color-text);
    text-fill-color: var(--color-text);
    vertical-align: middle;
}

.mcp-endpoint {
    display: block;
    margin: var(--space-md) 0 var(--space-xl);
    padding: var(--space-md) var(--space-lg);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--color-input-text);
    word-break: break-all;
}

.json-preview {
    display: block;
    margin: var(--space-lg) 0;
    padding: var(--space-lg);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
    color: var(--color-input-text);
    max-height: 24rem;
}

.admin-page ul {
    list-style: none;
    padding: 0;
}

.admin-user-list {
    margin-top: var(--space-lg);
}

.admin-user-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm) var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid rgba(197, 213, 220, 0.5);
}

.admin-user-row:last-child {
    border-bottom: 0;
}

.admin-user-link {
    color: var(--color-text);
    text-decoration: none;
    font-family: 'Antonio', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.04em;
}

.admin-user-link:hover {
    text-decoration: underline;
    color: var(--color-primary-hover);
}

.admin-user-display {
    font-family: 'Merriweather', serif;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.badge-role {
    font-family: 'Antonio', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(242, 242, 242, 0.9);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    -webkit-text-fill-color: var(--color-text-muted);
    text-fill-color: var(--color-text-muted);
}

.workspace-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 18rem;
    padding: clamp(2rem, 5vw, 3.5rem);
    text-align: center;
    background: var(--app-card-bg);
    border: 1px dashed rgba(197, 213, 220, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--app-shadow);
}

.workspace-empty h2 {
    margin: 0 0 var(--space-md);
    font-family: 'Antonio', sans-serif;
    font-weight: 500;
    font-size: 1.5rem;
    letter-spacing: 0.04em;
    color: var(--color-text);
}

.workspace-empty p {
    margin: 0;
    max-width: 28rem;
    font-family: 'Merriweather', serif;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--color-text-muted);
    -webkit-text-fill-color: var(--color-text-muted);
    text-fill-color: var(--color-text-muted);
}

.overview-stats {
    display: grid;
    gap: var(--space-md);
    margin: 0 0 var(--space-xl);
    padding: 0;
}

.overview-stats--grid {
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: var(--space-lg);
}

.overview-stat {
    margin: 0;
    padding: var(--space-md) var(--space-lg);
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(197, 213, 220, 0.65);
    border-radius: var(--radius-sm);
}

.overview-stat dt {
    margin: 0 0 var(--space-xs);
    font-family: 'Antonio', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    -webkit-text-fill-color: var(--color-text-muted);
    text-fill-color: var(--color-text-muted);
}

.overview-stat dd {
    margin: 0;
    font-family: 'Merriweather', serif;
    font-size: 1.05rem;
    color: var(--color-text);
    -webkit-text-fill-color: var(--color-text);
    text-fill-color: var(--color-text);
}

.overview-page h3 {
    margin-top: var(--space-xl);
}