/* ==========================================================================
   CSwiki design system
   ========================================================================== */

:root {
    color-scheme: light dark;

    --bg: light-dark(#faf9f7, #141417);
    --surface: light-dark(#ffffff, #1d1d22);
    --surface-2: light-dark(#f1f0ed, #26262d);
    --text: light-dark(#1c1c1e, #ececf1);
    --muted: light-dark(#6e6e76, #9b9ba6);
    --border: light-dark(rgba(28, 28, 30, 0.1), rgba(255, 255, 255, 0.1));
    --accent: light-dark(#4f46e5, #8b93ff);
    --accent-ink: light-dark(#ffffff, #17171c);
    --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
    --danger: light-dark(#dc2626, #f87171);
    --ok: light-dark(#16a34a, #4ade80);

    --radius-s: 8px;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);

    font-family: system-ui, -apple-system, sans-serif;
    font-optical-sizing: auto;
}

* { box-sizing: border-box; }

html { height: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

/* --------------------------------------------------------------------------
   Chrome
   -------------------------------------------------------------------------- */

header.site {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem clamp(1rem, 4vw, 2rem);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

header.site .wiki-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
    font-size: 1.05rem;
}
header.site .wiki-name:hover { text-decoration: none; opacity: 0.75; }

.wiki-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-ink);
    flex-shrink: 0;
    overflow: hidden;
}
.wiki-mark svg { width: 17px; height: 17px; }
.wiki-mark-image {
    background: transparent;
    padding: 0;
}
.wiki-mark-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

header.site nav {
    margin-left: auto;
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

header.site nav a {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    transition: background 120ms ease-out, color 120ms ease-out;
}
header.site nav a:hover {
    text-decoration: none;
    color: var(--text);
    background: var(--surface-2);
}

.header-search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 26rem;
    margin-left: 0.35rem;
}

.header-search-field {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 2.25rem;
    padding: 0.35rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: text;
    transition: border-color 120ms ease-out, box-shadow 120ms ease-out, background 120ms ease-out, color 120ms ease-out;
}
.header-search-field:hover {
    background: var(--surface-2);
}
.header-search-field:focus-within {
    border-color: var(--accent);
    background: var(--surface);
    color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.header-search-icon {
    flex-shrink: 0;
    display: block;
}

.header-search input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.4;
    appearance: none;
    -webkit-appearance: none;
}
.header-search input::placeholder { color: var(--muted); }
.header-search input:focus {
    outline: none;
    border: none;
    box-shadow: none;
}
.header-search input::-webkit-search-decoration,
.header-search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

/* --------------------------------------------------------------------------
   Shell: sidebar | content | rail
   -------------------------------------------------------------------------- */

.shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: stretch;
    min-height: calc(100vh - 3.6rem);
}
.shell.has-rail { grid-template-columns: 240px minmax(0, 1fr) 280px; }
.shell.no-sidebar { grid-template-columns: minmax(0, 1fr); }
.shell.no-sidebar.has-rail { grid-template-columns: minmax(0, 1fr) 280px; }

.shell main {
    min-width: 0;
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.25rem, 4vw, 3rem) 4rem;
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0.9rem 3rem;
    font-size: 0.9rem;
}
.sidebar-inner { position: sticky; top: 4.6rem; }
.sidebar .menu ul { list-style: none; margin: 0.25rem 0 1rem; padding: 0; }
.sidebar .menu ul ul { margin: 0.1rem 0 0.25rem; padding-left: 0.9rem; }
.sidebar .menu li { margin: 0; }
.sidebar .menu a {
    display: block;
    color: var(--muted);
    padding: 0.32rem 0.7rem;
    border-radius: var(--radius-s);
    transition: background 100ms ease-out, color 100ms ease-out;
}
.sidebar .menu a:hover { text-decoration: none; color: var(--text); background: var(--surface-2); }
.sidebar .menu p, .sidebar .menu h1, .sidebar .menu h2, .sidebar .menu h3 {
    font-size: 0.8rem;
    font-weight: 650;
    color: var(--text);
    margin: 1.1rem 0 0.2rem;
    padding: 0 0.7rem;
    letter-spacing: 0.01em;
}
.sidebar .menu p.muted { font-weight: 400; color: var(--muted); line-height: 1.6; }
.sidebar .menu-edit {
    display: block;
    margin-top: 1rem;
    padding: 0 0.7rem;
    font-size: 0.8rem;
    color: var(--muted);
}
.sidebar .menu-edit:hover { color: var(--accent); text-decoration: none; }

.rail {
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 2vw, 1.5rem) 3rem 0;
    font-size: 0.875rem;
}
.rail-inner, .rail {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.rail > * { flex-shrink: 0; }

.rail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
}
.rail-card h3 {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    color: var(--text);
}

.toc { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
    display: block;
    color: var(--muted);
    padding: 0.28rem 0.6rem;
    border-left: 2px solid var(--border);
    transition: color 100ms ease-out, border-color 100ms ease-out;
}
.toc a:hover { text-decoration: none; color: var(--accent); border-left-color: var(--accent); }
.toc .toc-l3 a { padding-left: 1.4rem; }

.update-feed { list-style: none; margin: 0; padding: 0; }
.update-feed li { padding: 0.4rem 0; display: flex; flex-direction: column; }
.update-feed li:not(:last-child) { border-bottom: 1px solid var(--border); }
.update-feed a { font-weight: 500; }
.update-feed .muted { font-size: 0.78rem; }

.page-facts { margin: 0; }
.page-facts > div {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
}
.page-facts dt { color: var(--muted); }
.page-facts dd { margin: 0; }

.site-info { padding: 1.15rem 1.2rem 1.1rem; }
.site-info-title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text);
    line-height: 1.35;
}
.site-info-cover {
    margin: 0 0 0.85rem;
    border-radius: var(--radius-s);
    overflow: hidden;
    aspect-ratio: 16 / 10;
    background: var(--border);
}
.site-info-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.site-info-description {
    margin: 0 0 0.85rem;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--muted);
}
.site-info-facts { margin-top: 0.15rem; }
.site-info-facts > div { padding: 0.35rem 0; gap: 0.75rem; }
.site-info-facts dd { font-variant-numeric: tabular-nums; text-align: right; }
.site-info-tags { margin-top: 0.9rem; }
.site-info-edit {
    display: inline-block;
    margin-top: 0.85rem;
    font-size: 0.8rem;
    color: var(--accent);
}

@media (max-width: 1120px) {
    .shell.has-rail { grid-template-columns: 240px minmax(0, 1fr); }
    .rail { display: none; }
}
@media (max-width: 820px) {
    .shell, .shell.has-rail { grid-template-columns: minmax(0, 1fr); }
    .sidebar { display: none; }
    .header-search { max-width: none; }
    .header-search-field { padding-inline: 0.75rem; }
}

/* --------------------------------------------------------------------------
   Callouts
   -------------------------------------------------------------------------- */

.callout {
    --c: #3b82f6;
    margin: 1.2em 0;
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--c) 7%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
}
.callout-info { --c: light-dark(#2f6fdb, #6ea8ff); }
.callout-tip { --c: light-dark(#188a4a, #4ade80); }
.callout-warning { --c: light-dark(#c07d10, #fbbf24); }
.callout-danger { --c: light-dark(#d03434, #f87171); }
.callout-note { --c: light-dark(#7c5cd6, #a78bfa); }

.callout-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.35rem;
    font-weight: 650;
    color: var(--c);
}
.callout-title svg { flex-shrink: 0; }
.callout p { margin: 0.35em 0; }
.callout > p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Tags
   -------------------------------------------------------------------------- */

.tag-list {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.tag-chip {
    display: inline-block;
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 550;
    background: light-dark(hsl(var(--h) 75% 93%), hsl(var(--h) 40% 24%));
    color: light-dark(hsl(var(--h) 65% 34%), hsl(var(--h) 75% 80%));
    text-decoration: none;
    transition: filter 120ms ease-out, transform 100ms ease-out;
}
a.tag-chip:hover { text-decoration: none; filter: brightness(0.96); }
.tag-chip:active { transform: scale(0.96); }
.tag-chip-lg { font-size: 1.1rem; padding: 0.25rem 1rem; vertical-align: middle; }

.tag-input {
    position: relative;
    display: grid;
    gap: 0.45rem;
}
.tag-input-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.6rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--surface);
    cursor: text;
}
.tag-input-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent);
}
.tag-input-chips {
    display: contents;
}
.tag-input-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    padding: 0.15rem 0.35rem 0.15rem 0.65rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 550;
    background: light-dark(hsl(var(--h) 75% 93%), hsl(var(--h) 40% 24%));
    color: light-dark(hsl(var(--h) 65% 34%), hsl(var(--h) 75% 80%));
    border: 1px solid transparent;
}
.tag-input-chip.is-new {
    border-style: dashed;
    border-color: light-dark(hsl(var(--h) 55% 58%), hsl(var(--h) 45% 52%));
    background: light-dark(hsl(var(--h) 80% 97%), hsl(var(--h) 35% 18%));
}
.tag-input-chip-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tag-input-chip-badge {
    flex: none;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: light-dark(hsl(var(--h) 70% 88%), hsl(var(--h) 40% 30%));
    color: light-dark(hsl(var(--h) 55% 32%), hsl(var(--h) 75% 85%));
}
.tag-input-chip-remove {
    flex: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    line-height: 1;
}
.tag-input-chip-remove:hover {
    opacity: 1;
    background: light-dark(hsl(var(--h) 60% 88%), hsl(var(--h) 35% 30%));
}
.tag-input-field {
    flex: 1 1 8rem;
    min-width: 8rem;
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0.25rem 0.15rem !important;
    margin: 0;
    font: inherit;
    color: inherit;
}
.tag-input-suggestions {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.35rem;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--surface);
    box-shadow: 0 10px 28px light-dark(rgba(20, 20, 30, 0.12), rgba(0, 0, 0, 0.35));
    max-height: 14rem;
    overflow: auto;
    display: grid;
    gap: 0.2rem;
}
.tag-input-suggestions[hidden] {
    display: none;
}
.tag-input-suggestion {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.55rem;
    border-radius: calc(var(--radius-s) - 2px);
    cursor: pointer;
}
.tag-input-suggestion:hover,
.tag-input-suggestion.is-active {
    background: var(--surface-2);
}
.tag-input-suggestion.is-empty {
    cursor: default;
    color: var(--muted);
    font-size: 0.9rem;
}
.tag-input-suggestion.is-create {
    border-top: 1px dashed var(--border);
    margin-top: 0.15rem;
    padding-top: 0.55rem;
}
.tag-input-create-label {
    flex: none;
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--muted);
}
.actions .tag-input {
    flex: 1;
    min-width: 0;
}

/* --------------------------------------------------------------------------
   Plugins
   -------------------------------------------------------------------------- */

.plugin-recent { list-style: none; margin: 1em 0; padding: 0; }
.plugin-recent li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: baseline;
    padding: 0.45rem 0.25rem;
}
.plugin-recent li:not(:last-child) { border-bottom: 1px solid var(--border); }
.plugin-recent a { font-weight: 500; }

.comments { margin: 2em 0; }

.comments-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.comments .comments-title {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}
.comments-count {
    font-size: 0.78rem;
    font-weight: 650;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
}

.comments-more { font-size: 0.82rem; margin-left: auto; }

.comment {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.35rem 0.25rem;
    font-size: 0.9rem;
    line-height: 1.55;
}
.comment:not(:last-of-type) { border-bottom: 1px solid var(--border); }
.comment-author { font-weight: 650; font-size: 0.85rem; flex-shrink: 0; }
.comment-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.comment time { font-size: 0.75rem; flex-shrink: 0; }
.comment-delete {
    display: inline;
    margin: 0;
    flex-shrink: 0;
}
.comment-delete .btn {
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
}
.comment-avatar {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    object-fit: cover;
    flex: none;
}
.comment-avatar-fallback {
    display: inline-grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
}
.comment-identity {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex: none;
}

.comments-empty {
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    background: var(--surface-2);
    border-radius: var(--radius);
}

.comment-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.comment-form .comment-name { flex: 0 0 7.5rem; }
.comment-form .comment-input { flex: 1; min-width: 0; }
.comment-form input[type="text"] { padding: 0.45rem 0.85rem; font-size: 0.9rem; }
.comment-form button.primary { padding: 0.45rem 1.2rem; flex-shrink: 0; }

/* Hero */
.hero {
    margin: 0 0 1.5rem;
    padding: clamp(1.75rem, 4vw, 3rem);
    border-radius: calc(var(--radius) + 4px);
    background:
        radial-gradient(120% 160% at 85% -20%, color-mix(in srgb, #8b5cf6 55%, transparent), transparent 60%),
        linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #1e1b4b));
    color: #fff;
    position: relative;
    overflow: hidden;
}
.hero-has-image {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.45), rgba(15, 23, 42, 0.62)),
        var(--hero-image) center / cover no-repeat;
    min-height: 14rem;
    display: flex;
    align-items: flex-end;
}
.hero-inner { position: relative; z-index: 1; }
.hero-title {
    margin: 0;
    font-size: clamp(1.7rem, 4.5vw, 2.5rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
}
.hero-description {
    margin: 0.75rem 0 0;
    max-width: 34rem;
    font-size: 0.975rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
}
.hero-actions { display: flex; gap: 0.6rem; margin-top: 1.5rem; flex-wrap: wrap; }
.hero-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(8px);
    transition: background 120ms ease-out, transform 100ms ease-out;
}
.hero-btn:hover { text-decoration: none; background: rgba(255, 255, 255, 0.24); }
.hero-btn:active { transform: scale(0.96); }
.hero-btn-primary { background: #fff; color: var(--accent); border-color: transparent; }
.hero-btn-primary:hover { background: rgba(255, 255, 255, 0.9); }

/* Nav cards */
.navcards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.75rem;
    margin: 1.2em 0;
}
.navcard {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 0.9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: inherit;
    transition: border-color 120ms ease-out, transform 100ms ease-out, box-shadow 120ms ease-out;
}
.navcard:hover {
    text-decoration: none;
    border-color: var(--accent);
    box-shadow: var(--shadow);
}
.navcard:active { transform: scale(0.98); }
.navcard-mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-weight: 700;
    background: light-dark(hsl(var(--h) 75% 92%), hsl(var(--h) 40% 25%));
    color: light-dark(hsl(var(--h) 60% 35%), hsl(var(--h) 75% 80%));
}
.navcard-text { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.navcard-title { font-weight: 650; font-size: 0.925rem; }
.navcard-desc {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.navcard-missing { opacity: 0.6; border-style: dashed; }

/* Popular */
.plugin-popular { list-style: none; margin: 1em 0; padding: 0; }
.plugin-popular li {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    padding: 0.45rem 0.25rem;
}
.plugin-popular li:not(:last-child) { border-bottom: 1px solid var(--border); }
.plugin-popular a { flex: 1; min-width: 0; font-weight: 500; }
.popular-rank {
    flex-shrink: 0;
    width: 1.6rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
}
.popular-rank-top { color: var(--accent); }

/* Stats */
.plugin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.75rem;
    margin: 1.2em 0;
}
.stat-tile {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 1rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 0.8rem; color: var(--muted); }

/* ls2 / related / random */
.plugin-ls2,
.plugin-related,
.plugin-random-list {
    list-style: none;
    margin: 1em 0;
    padding: 0;
}
.plugin-ls2 li,
.plugin-related li,
.plugin-random-list li {
    padding: 0.4rem 0.25rem;
}
.plugin-ls2 li:not(:last-child),
.plugin-related li:not(:last-child),
.plugin-random-list li:not(:last-child) {
    border-bottom: 1px solid var(--border);
}
.plugin-ls2 a,
.plugin-related a,
.plugin-random a,
.plugin-random-list a { font-weight: 500; }
.plugin-random { margin: 1em 0; }

/* history */
.plugin-history { margin: 1em 0; }
.plugin-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.plugin-history-list li {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.4rem 0.25rem;
}
.plugin-history-list li:not(:last-child) { border-bottom: 1px solid var(--border); }
.history-summary {
    flex: 1;
    min-width: 0;
    color: var(--muted);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}
.plugin-history-more { margin: 0.6rem 0 0; font-size: 0.875rem; }

/* vote */
.plugin-vote { margin: 1.2em 0; }
.plugin-vote-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.plugin-vote-list li {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.5rem 0.25rem;
}
.plugin-vote-list li:not(:last-child) { border-bottom: 1px solid var(--border); }
.vote-choice { flex: 1; min-width: 0; font-weight: 500; }
.vote-count {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    color: var(--muted);
    min-width: 2rem;
    text-align: right;
}
.vote-form { margin: 0; }
.vote-btn {
    padding: 0.25rem 0.85rem;
    font-size: 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
}
.vote-btn:hover { border-color: var(--accent); color: var(--accent); }
.vote-total { margin: 0.6rem 0 0; font-size: 0.85rem; }

/* --------------------------------------------------------------------------
   Theme toggle
   -------------------------------------------------------------------------- */

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: color 120ms ease-out, border-color 120ms ease-out, transform 100ms ease-out;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.icon-btn:active { transform: scale(0.92); }
header.site nav a.icon-btn { padding: 0; }

/* Tooltips */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    translate: -50% 0;
    white-space: nowrap;
    padding: 0.3rem 0.65rem;
    border-radius: 7px;
    font-size: 0.75rem;
    font-weight: 500;
    background: light-dark(#2c2c30, #e8e8ee);
    color: light-dark(#ffffff, #17171c);
    opacity: 0;
    scale: 0.92;
    pointer-events: none;
    transition: opacity 120ms ease-out, scale 120ms ease-out;
    transition-delay: 0ms;
    z-index: 30;
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    scale: 1;
    transition-delay: 350ms;
}
.theme-toggle .icon-sun { display: none; }
html.is-dark .theme-toggle .icon-sun { display: block; }
html.is-dark .theme-toggle .icon-moon { display: none; }

footer.site {
    padding: 2rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
}
footer.site a { color: inherit; }

/* --------------------------------------------------------------------------
   Page header block
   -------------------------------------------------------------------------- */

.page-head { margin-bottom: 2rem; }
.page-head-front { margin-bottom: 0.75rem; }

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    color: var(--muted);
}
.breadcrumbs .current { color: var(--text); }

.page-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-actions { display: flex; gap: 0.5rem; flex-shrink: 0; margin-top: 0.4rem; }
.btn-report { padding-inline: 0.7rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 550;
    cursor: pointer;
    transition: border-color 120ms ease-out, background 120ms ease-out, transform 100ms ease-out;
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.btn:active { transform: scale(0.96); }

.report-dialog {
    width: min(32rem, calc(100vw - 2rem));
    padding: 0;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.24);
}
.report-dialog::backdrop { background: rgba(15, 23, 42, 0.55); }
.report-form { display: grid; gap: 1rem; padding: 1.35rem; }
.report-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.report-dialog-head h2,
.report-dialog-head p { margin: 0; }
.report-dialog-head p { margin-top: 0.3rem; }
.report-dialog-close {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}
.report-form textarea {
    font: inherit;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    color: var(--text);
    resize: vertical;
}

h1.page-title {
    margin: 0;
    font-size: clamp(1.75rem, 5vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    font-weight: 750;
}
h1.page-title .muted { font-weight: 500; }

.page-meta {
    margin-top: 0.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.muted { color: var(--muted); font-size: 0.875rem; }

/* --------------------------------------------------------------------------
   Article typography
   -------------------------------------------------------------------------- */

article.prose { font-size: 1rem; }

article.prose > :first-child { margin-top: 0; }

article.prose h1,
article.prose h2,
article.prose h3 {
    letter-spacing: -0.015em;
    line-height: 1.3;
    margin: 2.2em 0 0.6em;
    font-weight: 700;
}
article.prose h1 { font-size: 1.55rem; }
article.prose h2 { font-size: 1.3rem; }
article.prose h3 { font-size: 1.1rem; }

article.prose p { margin: 0.9em 0; }

article.prose a.wiki-link {
    font-weight: 500;
    border-bottom: 1.5px solid color-mix(in srgb, var(--accent) 35%, transparent);
    transition: border-color 120ms ease-out, background 120ms ease-out;
    border-radius: 2px;
}
article.prose a.wiki-link:hover {
    text-decoration: none;
    background: var(--accent-soft);
    border-bottom-color: var(--accent);
}

article.prose code {
    font-family: ui-monospace, "SF Mono", Menlo, "Hiragino Sans", "Noto Sans JP", monospace;
    font-size: 0.875em;
    background: var(--surface-2);
    padding: 0.15em 0.45em;
    border-radius: 6px;
}

article.prose pre {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    line-height: 1.6;
}
article.prose pre code { background: none; padding: 0; }

article.prose blockquote {
    margin: 1.2em 0;
    padding: 0.1em 1.25em;
    border-left: 3px solid var(--accent);
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 0 var(--radius-s) var(--radius-s) 0;
}

article.prose table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin: 1.2em 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    overflow: hidden;
    font-size: 0.925rem;
}
article.prose th, article.prose td {
    padding: 0.5rem 0.9rem;
    text-align: left;
}
article.prose th {
    background: var(--surface-2);
    font-weight: 600;
}
article.prose tr:not(:last-child) td { border-bottom: 1px solid var(--border); }

article.prose img { max-width: 100%; border-radius: var(--radius-s); }
article.prose table img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    image-rendering: pixelated;
    border-radius: 0;
    vertical-align: middle;
}

article.prose hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5em 0;
}

article.prose ul, article.prose ol { padding-left: 1.4em; }
article.prose li { margin: 0.25em 0; }

/* --------------------------------------------------------------------------
   Forms & buttons
   -------------------------------------------------------------------------- */

button.primary {
    padding: 0.55rem 1.5rem;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.925rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 100ms ease-out, filter 120ms ease-out;
}
button.primary:hover { filter: brightness(1.08); }
button.primary:active { transform: scale(0.96); }

input[type="text"],
input[type="search"]:not(.header-search input) {
    width: 100%;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-s);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.925rem;
    transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
input[type="text"]:focus,
input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.page-body {
    width: 100%;
    min-height: 55vh;
    height: 100%;
    resize: vertical;
    font-family: ui-monospace, "SF Mono", Menlo, "Hiragino Sans", "Noto Sans JP", monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
    box-sizing: border-box;
}
textarea.page-body:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
}
.actions input[type="text"] { flex: 1; }

/* edit + preview + attachments */
.edit-mode-toggle {
    display: inline-flex;
    gap: 0.2rem;
    padding: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}
.edit-mode-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    cursor: pointer;
}
.edit-mode-btn:hover { color: var(--text); }
.edit-mode-btn.is-active,
.edit-mode-btn[aria-pressed="true"] {
    background: var(--accent-soft);
    color: var(--accent);
}

.edit-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 1.25rem;
    align-items: start;
}
.edit-layout[data-mode="preview"] {
    grid-template-columns: minmax(0, 1fr);
}
.edit-layout[data-mode="preview"] .attach-panel { display: none; }

.edit-form { min-width: 0; }

.edit-workspace {
    display: grid;
    gap: 1rem;
    align-items: stretch;
    min-height: 55vh;
}
.edit-workspace[data-mode="split"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.edit-workspace[data-mode="editor"] .edit-preview,
.edit-workspace[data-mode="preview"] .edit-source {
    display: none;
}

.edit-source,
.edit-preview {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-height: 55vh;
}
.edit-pane-label {
    font-size: 0.78rem;
    font-weight: 650;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.edit-source .page-body {
    flex: 1;
    min-height: 55vh;
    resize: none;
}
.edit-preview-body {
    flex: 1;
    min-height: 55vh;
    max-height: calc(100vh - 14rem);
    overflow: auto;
    padding: 1.1rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}
.edit-preview-body.is-loading {
    opacity: 0.65;
    transition: opacity 120ms ease-out;
}

.attach-panel {
    position: sticky;
    top: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.attach-panel-title {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    font-weight: 650;
}
.attach-panel-help {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
    line-height: 1.45;
}
.attach-drop {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4.5rem;
    padding: 0.75rem;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-s);
    background: var(--surface-2);
    cursor: pointer;
    text-align: center;
    transition: border-color 120ms ease-out, background 120ms ease-out;
}
.attach-drop:hover,
.attach-drop.is-dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.attach-drop-label {
    font-size: 0.85rem;
    color: var(--muted);
}
.attach-status {
    margin: 0.6rem 0 0;
    font-size: 0.8rem;
}
.attach-status-error { color: #c0392b; }
.attach-list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
    max-height: 40vh;
    overflow: auto;
}
.attach-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem;
    align-items: center;
}
.attach-insert {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
    width: 100%;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--surface-2);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}
.attach-insert:hover { border-color: var(--accent); }
.attach-insert img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--surface);
}
.attach-insert span {
    font-size: 0.8rem;
    overflow-wrap: anywhere;
    line-height: 1.3;
}
.attach-delete {
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.plugin-youtube {
    margin: 1.2em 0;
    max-width: 720px;
}
.plugin-youtube-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius-s);
    background: #000;
}
.plugin-youtube-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.plugin-x {
    margin: 1.2em 0;
    max-width: 550px;
}
.plugin-x .twitter-tweet {
    margin: 0 !important;
}

.plugin-attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin: 1em 0;
    padding: 0;
    list-style: none;
}
.plugin-attachments a {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    overflow: hidden;
    background: var(--surface-2);
    text-decoration: none;
    color: var(--text);
}
.plugin-attachments a:hover { border-color: var(--accent); }
.plugin-attachments img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.plugin-attachments span {
    display: block;
    padding: 0.4rem 0.5rem;
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
    .edit-workspace[data-mode="split"] {
        grid-template-columns: 1fr;
    }
    .edit-preview-body {
        max-height: none;
        min-height: 40vh;
    }
}
@media (max-width: 860px) {
    .edit-layout,
    .edit-layout[data-mode="preview"] { grid-template-columns: 1fr; }
    .attach-panel { position: static; }
    .page-title-row { flex-wrap: wrap; gap: 0.75rem; }
}

/* --------------------------------------------------------------------------
   Lists (history, page index, search)
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

table.history {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.925rem;
}
table.history th {
    text-align: left;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0.7rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
table.history td {
    text-align: left;
    padding: 0.65rem 1.1rem;
}
table.history tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
table.history tbody tr { transition: background 100ms ease-out; }
table.history tbody tr:hover { background: var(--accent-soft); }

.badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12rem 0.55rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    margin-left: 0.4rem;
    vertical-align: middle;
}

.badge-frozen {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.5rem;
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    color: var(--danger);
    vertical-align: middle;
}

.page-meta .badge-frozen { margin-left: 0; }

.header-auth-form { display: contents; }

.header-user-menu {
    position: relative;
}
.header-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    max-width: 12rem;
    padding: 0.2rem 0.55rem 0.2rem 0.2rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    transition: border-color 120ms ease-out, color 120ms ease-out;
}
.header-user-btn:hover,
.header-user-menu.is-open .header-user-btn {
    border-color: var(--accent);
    color: var(--accent);
}
.header-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 0.15rem;
}
.header-user-avatar {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    object-fit: cover;
    display: block;
    flex: none;
}
.header-user-avatar-fallback {
    display: inline-grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
}
.header-user-dropdown {
    position: absolute;
    top: calc(100% + 0.45rem);
    right: 0;
    z-index: 40;
    min-width: 11.5rem;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.header-user-dropdown a,
.header-user-dropdown button {
    display: block;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 0;
    border-radius: var(--radius-s);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 0.875rem;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}
.header-user-dropdown a:hover,
.header-user-dropdown button:hover {
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
}
.header-user-dropdown form { margin: 0; }

.menu-edit-frozen {
    cursor: default;
    opacity: 0.7;
}
.menu-edit-frozen:hover { text-decoration: none; color: var(--muted); }

.hero-btn-disabled {
    opacity: 0.7;
    cursor: default;
    pointer-events: none;
}

.auth-panel {
    max-width: 26rem;
    margin: 2rem auto 0;
}
.auth-panel .page-title { margin-bottom: 0.5rem; }
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 1.5rem;
    padding: 1.25rem 1.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.875rem;
    font-weight: 550;
}
.auth-field input {
    font: inherit;
    font-weight: 400;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    color: var(--text);
}
.auth-field input:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 1px;
}
.auth-field select,
.auth-field textarea {
    font: inherit;
    font-weight: 400;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    color: var(--text);
}
.auth-field select:focus,
.auth-field textarea:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 1px;
}
.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.875rem;
    color: var(--muted);
    font-weight: 400;
}
.auth-error {
    margin: -0.4rem 0 0;
    color: var(--danger);
    font-size: 0.85rem;
}
.auth-form .primary {
    align-self: flex-start;
    margin-top: 0.25rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-width: 36rem;
    margin-top: 0.5rem;
    padding: 1.35rem 1.45rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.settings-form textarea {
    font: inherit;
    font-weight: 400;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    min-height: 5rem;
}
.settings-form textarea:focus,
.settings-form input[type="file"]:focus {
    outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 1px;
}
.settings-form input[type="file"] {
    font: inherit;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--muted);
}
.field-hint {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--muted);
    line-height: 1.4;
}
.settings-cover-preview {
    border-radius: var(--radius-s);
    overflow: hidden;
    border: 1px solid var(--border);
    max-width: 20rem;
}
.settings-cover-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}
.settings-icon-preview {
    width: 3rem;
    height: 3rem;
    border-radius: 0.65rem;
    overflow: hidden;
    border: 1px solid var(--border);
}
.settings-icon-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.settings-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-top: 0.35rem;
}
.notice-success {
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.report-admin { max-width: 52rem; }
.report-list { display: grid; gap: 0.9rem; margin-top: 1rem; }
.report-card {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.report-card.is-resolved { opacity: 0.68; }
.report-card-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}
.report-card-head > div { display: flex; align-items: center; gap: 0.6rem; }
.report-card-head strong { color: var(--text); font-size: 1rem; }
.report-facts { display: grid; gap: 0.35rem; margin: 0.85rem 0; }
.report-facts > div { display: grid; grid-template-columns: 5rem 1fr; gap: 0.6rem; }
.report-facts dt { color: var(--muted); font-size: 0.8rem; }
.report-facts dd { margin: 0; }
.report-facts dd .muted { margin-left: 0.5rem; }
.report-message {
    white-space: pre-wrap;
    padding: 0.75rem;
    border-radius: var(--radius-s);
    background: var(--bg);
}
.contact-panel { max-width: 34rem; }
.contact-success { margin: 1.25rem 0 -0.25rem; }

@media (max-width: 600px) {
    .report-card-head { align-items: flex-start; flex-direction: column; }
    .report-facts > div { grid-template-columns: 1fr; gap: 0.1rem; }
}

.rollback-settings { max-width: 48rem; }
.rollback-settings .section-title { margin: 0 0 0.45rem; }
.rollback-scope { margin: 0; }
.rollback-preview-form,
.rollback-execute-form {
    display: grid;
    gap: 0.9rem;
}
.rollback-preview {
    display: grid;
    gap: 1rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--border);
}
.rollback-preview > p { margin: 0; }
.rollback-counts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0;
}
.rollback-counts > div {
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
}
.rollback-counts dt { color: var(--muted); font-size: 0.78rem; }
.rollback-counts dd { margin: 0.2rem 0 0; font-size: 1.15rem; font-weight: 700; }
.rollback-page-list {
    max-height: 14rem;
    overflow: auto;
    margin-bottom: 0;
}
.rollback-confirm { color: var(--text); }
.btn-danger {
    background: var(--danger);
    color: white;
    border-color: transparent;
}
.btn-danger:hover { color: white; filter: brightness(1.08); }

@media (max-width: 600px) {
    .rollback-counts { grid-template-columns: 1fr; }
}

.search-hit {
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    transition: border-color 120ms ease-out;
}
.search-hit:hover { border-color: var(--accent); }
.search-hit > a { font-weight: 600; font-size: 1.05rem; }
.search-hit p { margin: 0.3rem 0 0; }

/* --------------------------------------------------------------------------
   Notices, diff, empty states
   -------------------------------------------------------------------------- */

.notice {
    padding: 0.9rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    background: color-mix(in srgb, orange 10%, var(--surface));
    border: 1px solid color-mix(in srgb, orange 35%, transparent);
}
.notice p { margin: 0 0 0.5rem; }
.notice p:last-child { margin-bottom: 0; }

pre.diff {
    font-family: ui-monospace, "SF Mono", Menlo, "Hiragino Sans", "Noto Sans JP", monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0;
    overflow-x: auto;
}
pre.diff ins, pre.diff del, pre.diff span {
    display: block;
    text-decoration: none;
    padding: 0 1.1rem;
}
pre.diff ins { background: color-mix(in srgb, var(--ok) 14%, transparent); }
pre.diff del { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--muted);
}
.empty-state h1 {
    color: var(--text);
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}
.empty-state .cta {
    display: inline-block;
    margin-top: 1.25rem;
    padding: 0.6rem 1.6rem;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
    transition: transform 100ms ease-out, filter 120ms ease-out;
}
.empty-state .cta:hover { text-decoration: none; filter: brightness(1.08); }
.empty-state .cta:active { transform: scale(0.96); }

/* --------------------------------------------------------------------------
   Pagination (Laravel default markup)
   -------------------------------------------------------------------------- */

nav[role="navigation"] { margin-top: 1.5rem; font-size: 0.9rem; }

/* --------------------------------------------------------------------------
   Accessibility preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-transparency: reduce) {
    header.site {
        background: var(--bg);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * { transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}

@media (prefers-contrast: more) {
    :root { --border: light-dark(rgba(0, 0, 0, 0.4), rgba(255, 255, 255, 0.45)); }
}

/* --------------------------------------------------------------------------
   Portal (zone apex)
   -------------------------------------------------------------------------- */

.portal-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    background-image:
        radial-gradient(1200px 500px at 10% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
        radial-gradient(900px 420px at 100% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 55%);
    background-repeat: no-repeat;
    background-size: 100% 42rem;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(10px);
}
.portal-header-search {
    margin-left: 0;
    margin-right: auto;
    max-width: 22rem;
}
@media (max-width: 720px) {
    .portal-header {
        flex-wrap: wrap;
    }
    .portal-header-search {
        order: 3;
        flex: 1 1 100%;
        max-width: none;
    }
}

.integration-settings-card { padding: 1.25rem; }
.integration-settings-card > h2,
.integration-row h3 { margin-top: 0; }
.integration-token-notice code,
.integration-connection code {
    display: block;
    overflow-wrap: anywhere;
    user-select: all;
}
.integration-connection {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.6rem 1rem;
    margin-bottom: 0;
}
.integration-connection dt { font-weight: 650; }
.integration-connection dd { margin: 0; min-width: 0; }
.integration-config-example {
    margin: 0.75rem 0 0;
    padding: 1rem;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    font-size: 0.82rem;
    line-height: 1.55;
}
.integration-config-example code {
    display: block;
    min-width: max-content;
    user-select: all;
}
.integration-list { display: grid; gap: 0.75rem; }
.integration-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
}
.integration-row p { margin: 0.25rem 0 0; }
.integration-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.integration-actions form { margin: 0; }
@media (max-width: 640px) {
    .integration-connection { grid-template-columns: 1fr; }
    .integration-connection dd + dt { margin-top: 0.5rem; }
    .integration-row { align-items: flex-start; flex-direction: column; }
}

.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
}
.portal-brand:hover { text-decoration: none; color: var(--accent); }

.portal-nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.portal-nav-link {
    padding: 0.35rem 0.15rem;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
}
.portal-nav-link:hover {
    color: var(--text);
    text-decoration: none;
}

.portal-main {
    flex: 1;
    width: min(1040px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 4rem;
}

.portal-footer {
    padding: 1.25rem 1.5rem 2rem;
    text-align: center;
}
.portal-footer-nav {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 0.65rem;
    font-size: 0.85rem;
}
.portal-footer p { margin: 0; }

.portal-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(18rem, 0.65fr);
    align-items: end;
    gap: clamp(2rem, 7vw, 5rem);
    padding: clamp(3.75rem, 8vw, 6.5rem) 0 clamp(3rem, 6vw, 5rem);
}
.portal-kicker {
    margin: 0 0 0.8rem;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.portal-hero-title {
    margin: 0 0 1.25rem;
    max-width: 12em;
    font-size: clamp(2.65rem, 6.5vw, 4.75rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.045em;
}
.portal-hero-lead {
    margin: 0 0 1.75rem;
    max-width: 39rem;
    color: var(--muted);
    font-size: clamp(1rem, 1.8vw, 1.12rem);
    line-height: 1.85;
}
.portal-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.portal-primary-action {
    padding-inline: 1.25rem;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 22%, transparent);
}
.portal-hero-points {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}
.portal-hero-points > div {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.portal-hero-points dt {
    margin-bottom: 0.15rem;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 650;
}
.portal-hero-points dd {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.55;
}
.portal-hero-points code {
    overflow-wrap: anywhere;
    font: inherit;
    color: var(--muted);
}

.portal-demo-showcase {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 0.88fr) minmax(22rem, 1.12fr);
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 70px color-mix(in srgb, var(--accent) 10%, transparent);
}
.portal-demo-visual {
    position: relative;
    min-height: 23rem;
    overflow: hidden;
    background: var(--surface-2);
}
.portal-demo-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 35%, color-mix(in srgb, var(--accent) 24%, transparent));
    pointer-events: none;
}
.portal-demo-visual > img:not(.portal-demo-fallback-icon) {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 23rem;
    object-fit: cover;
}
.portal-demo-visual-empty {
    display: grid;
    place-items: center;
    background:
        radial-gradient(90% 120% at 25% 20%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 65%),
        var(--surface-2);
}
.portal-demo-fallback-icon {
    width: 5rem;
    height: 5rem;
    border-radius: 1.25rem;
    object-fit: cover;
    box-shadow: var(--shadow);
}
.portal-demo-label {
    position: absolute;
    z-index: 1;
    top: 1rem;
    left: 1rem;
    display: inline-flex;
    align-items: center;
    min-height: 1.9rem;
    padding: 0.25rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.48);
    border-radius: 999px;
    background: rgba(20, 20, 23, 0.58);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.portal-demo-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(2rem, 5vw, 3.5rem);
}
.portal-demo-body h2 {
    margin: 0 0 1rem;
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    line-height: 1.25;
    letter-spacing: -0.035em;
}
.portal-demo-body > p:not(.portal-kicker) {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}
.portal-demo-body strong {
    color: var(--text);
    font-weight: 650;
}
.portal-demo-notes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 1.35rem 0 1.5rem;
    padding: 0;
    list-style: none;
}
.portal-demo-notes li {
    padding: 0.28rem 0.68rem;
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 650;
}
.portal-demo-action {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    padding-inline: 1.15rem;
}
.portal-demo-action span { font-size: 1.05rem; }

.portal-onboarding {
    margin-top: clamp(4rem, 8vw, 6.5rem);
}
.portal-section-intro { margin-bottom: 1.5rem; }
.portal-section-intro h2 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
    line-height: 1.3;
    letter-spacing: -0.025em;
}

.portal-features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 0;
}
.portal-features article {
    padding: 1.35rem 1.4rem 1.45rem;
    border-top: 1px solid var(--border);
}
.portal-features h3 {
    margin: 1rem 0 0.35rem;
    font-size: 1rem;
}
.portal-features p { margin: 0; }
.portal-step-number {
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.08em;
}

.portal-product-intro {
    display: grid;
    grid-template-columns: minmax(15rem, 0.72fr) minmax(0, 1.28fr);
    gap: clamp(2rem, 7vw, 5rem);
    margin-top: clamp(4rem, 8vw, 6.5rem);
    padding: clamp(2rem, 5vw, 3.5rem);
    border: 1px solid var(--border);
    border-radius: 20px;
    background: color-mix(in srgb, var(--surface) 84%, transparent);
}
.portal-product-intro .portal-section-intro { margin: 0; }
.portal-product-intro .portal-section-intro p:last-child {
    margin: 1rem 0 0;
    line-height: 1.75;
}
.portal-product-links {
    display: grid;
    border-top: 1px solid var(--border);
}
.portal-product-link {
    position: relative;
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) auto;
    gap: 0.25rem 0.75rem;
    padding: 1.25rem 0.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}
.portal-product-link:hover {
    color: var(--accent);
    text-decoration: none;
}
.portal-product-link-index {
    grid-row: 1 / span 2;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.portal-product-link strong { font-size: 1rem; }
.portal-product-link > span:not(.portal-product-link-index):not(.portal-product-link-arrow) {
    grid-column: 2;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.55;
}
.portal-product-link-arrow {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    font-size: 1.1rem;
}

.portal-content-page,
.portal-docs-page {
    padding-top: clamp(2.5rem, 6vw, 5rem);
}
.portal-content-hero {
    max-width: 48rem;
    padding-bottom: clamp(3.5rem, 8vw, 6.5rem);
}
.portal-content-hero h1 {
    margin: 0 0 1.25rem;
    font-size: clamp(2.5rem, 7vw, 4.6rem);
    line-height: 1.08;
    letter-spacing: -0.045em;
}
.portal-content-hero > p:not(.portal-kicker) {
    max-width: 42rem;
    margin: 0 0 1.75rem;
    color: var(--muted);
    font-size: clamp(1rem, 1.8vw, 1.12rem);
    line-height: 1.85;
}
.portal-feature-block {
    display: grid;
    grid-template-columns: minmax(14rem, 0.7fr) minmax(0, 1.3fr);
    gap: clamp(2rem, 7vw, 5rem);
    padding: clamp(3rem, 7vw, 5rem) 0;
    border-top: 1px solid var(--border);
}
.portal-feature-heading > span,
.portal-docs-eyebrow {
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.portal-feature-heading h2 {
    margin: 0.8rem 0 1rem;
    font-size: clamp(1.75rem, 4vw, 2.65rem);
    line-height: 1.2;
    letter-spacing: -0.035em;
}
.portal-feature-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}
.portal-feature-grid {
    display: grid;
    gap: 0;
    border-top: 1px solid var(--border);
}
.portal-feature-grid article {
    padding: 1.35rem 0;
    border-bottom: 1px solid var(--border);
}
.portal-feature-grid h3 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
}
.portal-feature-grid p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}
.portal-feature-grid code { color: var(--text); }
.portal-feature-highlight {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin: clamp(3rem, 7vw, 5rem) 0;
    padding: clamp(2rem, 6vw, 4rem);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
    border-radius: 20px;
    background:
        radial-gradient(700px 300px at 0% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 68%),
        var(--surface);
}
.portal-feature-highlight > div { max-width: 39rem; }
.portal-feature-highlight h2 {
    margin: 0 0 0.8rem;
    font-size: clamp(1.75rem, 4vw, 2.65rem);
    letter-spacing: -0.035em;
}
.portal-feature-highlight p:last-child {
    margin: 0;
    color: var(--muted);
    line-height: 1.8;
}
.portal-feature-highlight > .btn { flex: none; }
.portal-content-cta {
    padding: clamp(3rem, 7vw, 5rem) 0 2rem;
    text-align: center;
}
.portal-content-cta h2 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.8rem, 4vw, 2.75rem);
    letter-spacing: -0.035em;
}
.portal-content-cta > p:not(.portal-kicker) { margin: 0 0 1.5rem; }

.portal-docs-hero { padding-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.portal-docs-layout {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: clamp(2.5rem, 7vw, 5rem);
    align-items: start;
}
.portal-docs-nav {
    position: sticky;
    top: 1.5rem;
    padding-top: 0.5rem;
}
.portal-docs-nav nav {
    display: grid;
    gap: 0.15rem;
    border-left: 1px solid var(--border);
}
.portal-docs-nav p {
    margin: 1rem 0 0.35rem;
    padding-left: 1rem;
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.portal-docs-nav p:first-child { margin-top: 0; }
.portal-docs-nav a {
    padding: 0.3rem 0 0.3rem 1rem;
    color: var(--muted);
    font-size: 0.84rem;
    text-decoration: none;
}
.portal-docs-nav a:hover {
    color: var(--accent);
    text-decoration: none;
}
.portal-docs-content { min-width: 0; }
.portal-docs-content > section {
    scroll-margin-top: 1.5rem;
    padding: 0 0 clamp(3.5rem, 8vw, 6rem);
}
.portal-docs-content > section + section {
    padding-top: clamp(3rem, 6vw, 4.5rem);
    border-top: 1px solid var(--border);
}
.portal-docs-content h2 {
    margin: 0.65rem 0 1.2rem;
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.25;
    letter-spacing: -0.035em;
}
.portal-docs-content h3 {
    margin: 2rem 0 0.75rem;
    font-size: 1.05rem;
}
.portal-docs-content > section > p:not(.portal-docs-eyebrow),
.portal-docs-content li {
    line-height: 1.8;
}
.portal-docs-content ul { padding-left: 1.25rem; }
.portal-docs-content ol {
    display: grid;
    gap: 0;
    margin: 1.5rem 0;
    padding: 0;
    border-top: 1px solid var(--border);
    list-style: none;
    counter-reset: docs-step;
}
.portal-docs-content ol li {
    position: relative;
    display: grid;
    grid-template-columns: minmax(10rem, 0.55fr) minmax(0, 1.45fr);
    gap: 1rem;
    padding: 1rem 0 1rem 2.75rem;
    border-bottom: 1px solid var(--border);
    counter-increment: docs-step;
}
.portal-docs-content ol li::before {
    content: counter(docs-step, decimal-leading-zero);
    position: absolute;
    top: 1rem;
    left: 0;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
}
.portal-docs-content ol span { color: var(--muted); }
.portal-docs-note {
    margin: 1.5rem 0;
    padding: 1rem 1.1rem;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
}
.portal-docs-note p {
    margin: 0.35rem 0 0;
    color: var(--muted);
    line-height: 1.7;
}
.portal-docs-note-warning { border-left-color: var(--warning, #c38319); }
.portal-docs-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.portal-docs-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 0.9rem;
}
.portal-docs-table-wrap th,
.portal-docs-table-wrap td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
.portal-docs-table-wrap th {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}
.portal-docs-table-wrap tr:last-child td { border-bottom: 0; }
.portal-docs-content pre {
    margin: 1rem 0 1.5rem;
    padding: 1rem 1.1rem;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.82rem;
    line-height: 1.65;
}
.portal-docs-content pre code {
    display: block;
    min-width: max-content;
}
.portal-docs-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.portal-docs-cards article {
    padding: 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.portal-docs-cards h3 { margin: 0 0 0.45rem; }
.portal-docs-cards p {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.7;
}
.portal-docs-snapshot {
    margin: 1.5rem 0 2rem;
}
.portal-docs-snapshot img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 0.25rem);
    background: var(--surface);
    box-shadow: 0 1.25rem 3rem color-mix(in srgb, #000 12%, transparent);
}
.portal-docs-snapshot figcaption {
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.6;
}
.portal-docs-link-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.portal-docs-link-grid > a {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
}
.portal-docs-link-grid > a:hover {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
    color: var(--accent);
    text-decoration: none;
}
.portal-docs-link-grid span {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.6;
}
.portal-docs-endpoints {
    display: grid;
    margin: 1rem 0 1.5rem;
    border-top: 1px solid var(--border);
}
.portal-docs-endpoints > div {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: 0.25rem 0.75rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
}
.portal-docs-endpoints > div > code {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}
.portal-docs-endpoints > div > span {
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9rem;
}
.portal-docs-endpoints p {
    grid-column: 2;
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.6;
}
.portal-api-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 1.5rem 0 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.portal-api-meta > div {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}
.portal-api-meta > div:nth-child(odd) { border-right: 1px solid var(--border); }
.portal-api-meta > div:nth-last-child(-n + 2) { border-bottom: 0; }
.portal-api-meta span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.portal-api-meta code { overflow-wrap: anywhere; }
.portal-api-operation {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    scroll-margin-top: 1.5rem;
}
.portal-api-operation > header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.portal-api-operation > header > code {
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 700;
}
.portal-api-method {
    flex: none;
    min-width: 3.8rem;
    padding: 0.3rem 0.45rem;
    border-radius: 0.35rem;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-align: center;
}
.portal-api-method-get { background: #2877b5; }
.portal-api-method-post { background: #23875c; }
.portal-api-method-put { background: #b56a16; }
.portal-api-operation-id {
    margin-left: auto;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
}
.portal-api-operation > p {
    color: var(--muted);
    line-height: 1.75;
}
.portal-api-operation-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 1rem 0;
    color: var(--muted);
    font-size: 0.82rem;
}
.portal-api-required {
    color: var(--danger, #c13c3c);
    font-size: 0.78rem;
    font-weight: 700;
}
.portal-api-content-type {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 400;
}
.portal-api-responses {
    padding: 0.85rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.portal-mcp-clients {
    display: grid;
    gap: 1rem;
    margin: 1rem 0 2rem;
}
.portal-mcp-clients > article {
    min-width: 0;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.portal-mcp-clients > article > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.portal-mcp-clients > article > header strong { font-size: 1.05rem; }
.portal-mcp-clients > article > p {
    margin: 0.75rem 0;
    color: var(--muted);
    line-height: 1.7;
}
.portal-mcp-clients > article > a {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
}
.portal-mcp-clients ol {
    margin: 0.75rem 0;
}
.portal-mcp-clients pre {
    margin-bottom: 0.75rem;
}
.portal-mcp-status {
    flex: none;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}
.portal-mcp-status-ready {
    color: #277b55;
    background: color-mix(in srgb, #39a875 15%, transparent);
}
.portal-mcp-status-limited {
    color: var(--warning, #b16b13);
    background: color-mix(in srgb, #d68a27 15%, transparent);
}

.portal-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.portal-section { margin-top: 3rem; }
.portal-section-wikis {
    margin-top: clamp(4rem, 8vw, 6rem);
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.portal-section-title {
    margin: 0 0 0.85rem;
    font-size: 1.05rem;
}
.portal-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}
.portal-section-head .portal-section-title { margin: 0; }
.portal-section-more {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.wiki-card-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.wiki-card {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.15rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.wiki-card-body h3 { margin: 0 0 0.2rem; font-size: 1.1rem; }
.wiki-card-body p { margin: 0.25rem 0 0; }
.wiki-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-start;
}
.wiki-card-row {
    align-items: stretch;
    padding: 0;
    overflow: hidden;
    position: relative;
}
.wiki-card-row-hit {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.wiki-card-row .tag-list,
.wiki-card-row .tag-chip {
    position: relative;
    z-index: 2;
}
.wiki-card-thumb {
    display: grid;
    place-items: center;
    width: 10.5rem;
    flex-shrink: 0;
    align-self: stretch;
    min-height: 6.5rem;
    background: var(--surface-2);
    overflow: hidden;
}
.wiki-card-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.wiki-card-thumb-empty {
    background:
        radial-gradient(120% 140% at 85% -10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 55%),
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 75%, #1e1b4b), color-mix(in srgb, var(--accent) 40%, #312e81));
}
.wiki-card-thumb-icon {
    width: 2.75rem !important;
    height: 2.75rem !important;
    border-radius: 0.7rem;
    object-fit: cover;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.wiki-card-row .wiki-card-body {
    flex: 1;
    min-width: 12rem;
    padding: 1rem 1.15rem;
}
.wiki-card-row .wiki-card-actions {
    position: relative;
    z-index: 2;
    padding: 1rem 1.15rem 1rem 0.5rem;
    align-items: center;
}
.wiki-card-title-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.wiki-card-title-row h3 { margin: 0; }
.wiki-card-title-row .badge { margin-left: 0; }
.wiki-card-icon {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 0.45rem;
    object-fit: cover;
    flex-shrink: 0;
}
.wiki-card-rank {
    display: inline-grid;
    place-items: center;
    min-width: 1.6rem;
    height: 1.6rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}
.wiki-card-views { font-size: 0.85rem; }
.wiki-card-row .tag-list { margin-top: 0.55rem; }
.portal-wiki-rows { margin-top: 0.85rem; }

@media (max-width: 720px) {
    .wiki-card-row {
        flex-direction: column;
    }
    .wiki-card-thumb {
        width: 100%;
        min-height: 0;
        aspect-ratio: 16 / 10;
    }
    .wiki-card-row .wiki-card-body {
        padding: 1rem 1.15rem 0.35rem;
    }
    .wiki-card-row .wiki-card-actions {
        padding: 0.35rem 1.15rem 1.1rem;
    }
}

.btn-accent {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: transparent;
}
.btn-accent:hover {
    text-decoration: none;
    filter: brightness(1.06);
    color: var(--accent-ink);
}

.auth-panel-wide { max-width: 32rem; }
.auth-footer { margin-top: 1.25rem; text-align: center; }
.settings-subnav { margin: 0.5rem 0 0; font-size: 0.9rem; }
.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0 0 1.5rem;
    padding: 0.3rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.settings-tab {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-radius: calc(var(--radius) - 2px);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}
.settings-tab:hover {
    text-decoration: none;
    color: var(--text);
    background: var(--surface-2);
}
.settings-tab.is-active {
    color: var(--accent-ink);
    background: var(--accent);
}
.settings-visibility {
    border: 0;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}
.settings-visibility legend {
    font-weight: 650;
    margin-bottom: 0.15rem;
}
.settings-passphrase {
    margin-top: 0.35rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    display: grid;
    gap: 0.65rem;
}
.settings-passphrase[hidden] {
    display: none;
}
.settings-nested-option {
    margin-top: 0.15rem;
    margin-left: 0.15rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    display: grid;
    gap: 0.45rem;
}
.settings-nested-option[hidden] {
    display: none;
}
.settings-readonly {
    margin: 0;
    font-weight: 500;
}
.settings-section { margin-top: 0; }
.settings-section + .settings-section { margin-top: 2rem; }
.settings-avatar-preview,
.settings-hero-preview {
    width: 5.5rem;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.settings-hero-preview {
    width: min(100%, 22rem);
    border-radius: var(--radius-s);
}
.settings-avatar-preview img,
.settings-hero-preview img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}
.settings-hero-preview img { aspect-ratio: 16 / 9; }
.member-row-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.member-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    object-fit: cover;
    flex: none;
}
.member-avatar-fallback {
    display: inline-grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 700;
}
.unlock-panel { max-width: 28rem; margin: 2rem auto; }
.portal-wiki-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.85rem;
}
.portal-wiki-card {
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    position: relative;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.portal-wiki-card:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.portal-wiki-card-hit {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.portal-wiki-card .tag-list,
.portal-wiki-card .tag-chip {
    position: relative;
    z-index: 2;
}
.portal-wiki-rank {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    z-index: 2;
    display: inline-grid;
    place-items: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    pointer-events: none;
}
.portal-wiki-card-link {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    height: 100%;
}
.portal-wiki-card-link:hover {
    text-decoration: none;
    color: inherit;
}
.portal-wiki-card .wiki-card-body {
    padding: 1rem 1.1rem 1.15rem;
    flex: 1;
}
.portal-wiki-grid-top {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) {
    .portal-wiki-grid-top {
        grid-template-columns: 1fr;
    }
}
.portal-tag-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}
.portal-tag-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.35rem 0.85rem;
    font-size: 0.875rem;
    border: 1px solid color-mix(in srgb, hsl(var(--h) 55% 50%) 18%, var(--border));
    background: light-dark(
        color-mix(in srgb, hsl(var(--h) 70% 92%) 70%, var(--surface)),
        color-mix(in srgb, hsl(var(--h) 35% 22%) 55%, var(--surface))
    );
    transition: border-color 120ms ease-out, background 120ms ease-out, transform 100ms ease-out;
}
.portal-tag-item:hover {
    border-color: color-mix(in srgb, hsl(var(--h) 55% 50%) 40%, var(--border));
    filter: none;
    background: light-dark(
        color-mix(in srgb, hsl(var(--h) 70% 90%) 85%, var(--surface)),
        color-mix(in srgb, hsl(var(--h) 35% 26%) 70%, var(--surface))
    );
}
.portal-tag-count {
    font-variant-numeric: tabular-nums;
    font-weight: 550;
    opacity: 0.72;
}
.portal-wiki-cover {
    display: block;
    aspect-ratio: 16 / 10;
    background: var(--surface-2);
}
.portal-wiki-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.portal-wiki-cover-empty {
    display: grid;
    place-items: center;
    background:
        radial-gradient(120% 140% at 85% -10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 55%),
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 75%, #1e1b4b), color-mix(in srgb, var(--accent) 40%, #312e81));
}
.portal-wiki-cover-fallback-icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.85rem;
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.portal-wiki-card .wiki-card-title-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.portal-wiki-card .wiki-card-title-row h3 { margin: 0; }
.portal-wiki-card .wiki-card-icon {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 0.45rem;
    object-fit: cover;
    flex-shrink: 0;
}
.badge-public {
    background: color-mix(in srgb, var(--ok) 14%, var(--surface));
    color: var(--ok);
}
.badge-private {
    background: color-mix(in srgb, var(--muted) 16%, var(--surface));
    color: var(--muted);
}

.slug-field {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.slug-field input { flex: 1; min-width: 0; }
.slug-suffix {
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 400;
    white-space: nowrap;
}

.auth-form textarea {
    font: inherit;
    font-weight: 400;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    color: var(--text);
    resize: vertical;
    min-height: 4.5rem;
}

.member-list {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: 0; }
.member-row .muted { margin-left: 0.5rem; font-size: 0.875rem; }
.member-row .badge {
    margin-left: 0.55rem;
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.member-row-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: none;
}
.member-role-form select,
.auth-field select {
    font: inherit;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    color: var(--text);
}
.edit-identity {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 1rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.edit-identity-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    object-fit: cover;
    flex: none;
}
.edit-identity-avatar-fallback {
    display: inline-grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--muted);
    font-weight: 700;
}
.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;
}

/* --------------------------------------------------------------------------
   Back office
   -------------------------------------------------------------------------- */

.admin-shell {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: 2rem;
    width: min(100%, 1280px);
    margin: 0 auto;
    padding: 2rem 0 4rem;
}
.admin-sidebar {
    position: sticky;
    top: 5.5rem;
    align-self: start;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.admin-sidebar-label,
.admin-eyebrow {
    margin: 0 0 0.5rem;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.admin-sidebar nav { display: grid; gap: 0.25rem; }
.admin-sidebar nav a {
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-s);
    color: var(--muted);
    font-weight: 600;
}
.admin-sidebar nav a:hover,
.admin-sidebar nav a.is-active {
    color: var(--text);
    text-decoration: none;
    background: var(--accent-soft);
}
.admin-content { min-width: 0; }
.admin-content > .page-head { margin-bottom: 1.5rem; }
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.admin-stat-grid article {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.admin-stat-grid span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}
.admin-stat-grid strong {
    display: block;
    margin-top: 0.15rem;
    font-size: 1.6rem;
    line-height: 1.3;
}
.admin-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.admin-panel,
.admin-contact-detail {
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.admin-panel h2 { margin: 0; font-size: 1rem; }
.admin-compact-list { display: grid; }
.admin-compact-list > a {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 0.6rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}
.admin-compact-list > a:last-child { border-bottom: 0; }
.admin-compact-list > a:hover { text-decoration: none; }
.admin-compact-list .muted { grid-column: 2; font-size: 0.82rem; }
.admin-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}
.admin-filter a {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.85rem;
}
.admin-filter a:hover,
.admin-filter a.is-active {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
    background: var(--accent-soft);
}
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.admin-table th,
.admin-table td {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.admin-table th {
    color: var(--muted);
    background: var(--surface-2);
    font-size: 0.75rem;
    white-space: nowrap;
}
.admin-table .badge { white-space: nowrap; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table-sub {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
}
.admin-table-empty { text-align: center !important; color: var(--muted); }
.admin-row-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-width: 23rem;
}
.admin-row-actions form { margin: 0; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.wiki-status-active,
.contact-status-completed {
    color: var(--ok);
    background: color-mix(in srgb, var(--ok) 12%, var(--surface));
}
.wiki-status-archived,
.contact-status-unhandled,
.contact-status-in_progress {
    color: #b56a00;
    background: color-mix(in srgb, #f59e0b 14%, var(--surface));
}
.wiki-status-banned,
.contact-status-ignored {
    color: var(--danger);
    background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}
.contact-status-unread {
    color: var(--accent);
    background: var(--accent-soft);
}
.admin-contact-list {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.admin-contact-row {
    display: grid;
    grid-template-columns: auto 11rem 8rem minmax(12rem, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.85rem;
}
.admin-contact-row:last-child { border-bottom: 0; }
.admin-contact-row:hover { text-decoration: none; background: var(--surface-2); }
.admin-contact-row small { display: block; color: var(--muted); }
.admin-contact-row time { color: var(--muted); white-space: nowrap; }
.admin-contact-summary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.back-link { display: inline-block; margin-bottom: 1rem; }
.admin-contact-detail > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}
.admin-contact-detail h1 { margin: 0.35rem 0 0; font-size: 1.35rem; }
.admin-status-form {
    display: flex;
    align-items: end;
    gap: 0.5rem;
}
.admin-status-form label { display: grid; gap: 0.2rem; }
.admin-status-form label span { color: var(--muted); font-size: 0.75rem; }
.admin-status-form select {
    min-width: 8rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    color: var(--text);
}
.admin-detail-facts { margin: 1rem 0; }
.admin-detail-facts div {
    display: grid;
    grid-template-columns: 8rem 1fr;
    padding: 0.35rem 0;
}
.admin-detail-facts dt { color: var(--muted); }
.admin-detail-facts dd { margin: 0; }
.admin-message {
    padding: 1rem;
    border-radius: var(--radius-s);
    background: var(--surface-2);
    white-space: pre-wrap;
}
.support-thread {
    display: grid;
    gap: 0.75rem;
    margin: 1rem 0;
}
.support-comment {
    max-width: 82%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.support-comment.is-bo {
    justify-self: end;
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
    background: var(--accent-soft);
}
.support-comment header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.82rem;
}
.support-comment time { color: var(--muted); white-space: nowrap; }
.support-comment p { margin: 0.4rem 0 0; white-space: pre-wrap; }
.support-comment-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.support-comment-form textarea {
    width: 100%;
    font: inherit;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-s);
    background: var(--bg);
    color: var(--text);
    resize: vertical;
}
.wiki-lifecycle-banner {
    padding: 0.35rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.wiki-lifecycle-banner strong { margin-right: 0.4rem; }
.bo-login-panel {
    border-top: 3px solid var(--accent);
}
.audit-log-list {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.audit-log-row {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: start;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
}
.audit-log-row:last-child { border-bottom: 0; }
.audit-log-row time,
.audit-log-row code {
    color: var(--muted);
    font-size: 0.78rem;
    white-space: nowrap;
}
.audit-log-row p { margin: 0.15rem 0 0.35rem; }
.audit-log-row .muted {
    display: block;
    font-size: 0.78rem;
}

@media (max-width: 720px) {
    .portal-main { width: min(100% - 1.25rem, 1040px); }
    .portal-hero {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 2.5rem;
        padding-top: 3rem;
    }
    .portal-hero-title {
        font-size: clamp(2.35rem, 10vw, 3rem);
        word-break: keep-all;
    }
    .portal-demo-showcase { grid-template-columns: 1fr; }
    .portal-demo-visual,
    .portal-demo-visual > img:not(.portal-demo-fallback-icon) { min-height: 13rem; }
    .portal-demo-visual { max-height: 16rem; }
    .portal-demo-body { padding: 1.65rem 1.35rem 1.8rem; }
    .portal-demo-body h2 { font-size: 1.55rem; }
    .portal-features { grid-template-columns: 1fr; }
    .portal-header { padding-inline: 1rem; }
    .portal-nav {
        flex: 1 1 auto;
        justify-content: flex-end;
    }
    .portal-nav .btn,
    .portal-nav button {
        flex-shrink: 0;
        white-space: nowrap;
    }
    .portal-nav-link { display: none; }
    .portal-product-intro,
    .portal-feature-block,
    .portal-docs-layout {
        grid-template-columns: 1fr;
    }
    .portal-product-intro {
        gap: 1.75rem;
        padding: 1.5rem 1.25rem;
    }
    .portal-feature-block { gap: 2rem; }
    .portal-feature-highlight {
        align-items: flex-start;
        flex-direction: column;
    }
    .portal-docs-nav {
        position: static;
        overflow-x: auto;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border);
    }
    .portal-docs-nav nav {
        display: flex;
        width: max-content;
        border-left: 0;
    }
    .portal-docs-nav p { display: none; }
    .portal-docs-nav a {
        padding: 0.45rem 0.65rem;
        border: 1px solid var(--border);
        border-radius: 999px;
        white-space: nowrap;
    }
    .portal-docs-content ol li {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
    .portal-docs-cards { grid-template-columns: 1fr; }
    .portal-docs-link-grid { grid-template-columns: 1fr; }
    .portal-api-meta { grid-template-columns: 1fr; }
    .portal-api-meta > div,
    .portal-api-meta > div:nth-child(odd),
    .portal-api-meta > div:nth-last-child(-n + 2) {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .portal-api-meta > div:last-child { border-bottom: 0; }
    .portal-api-operation > header { align-items: flex-start; }
    .portal-api-operation-id { display: none; }
    .portal-mcp-clients > article { padding: 1rem; }
    .portal-mcp-clients > article > header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }
    .admin-shell { grid-template-columns: 1fr; gap: 1rem; padding-top: 1rem; }
    .admin-sidebar { position: static; }
    .admin-sidebar nav { display: flex; overflow-x: auto; }
    .admin-sidebar nav a { white-space: nowrap; }
    .admin-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-dashboard-grid { grid-template-columns: 1fr; }
    .admin-contact-row {
        grid-template-columns: auto 1fr auto;
    }
    .admin-contact-row > :nth-child(3),
    .admin-contact-summary { display: none; }
    .admin-contact-detail > header { flex-direction: column; }
    .support-comment { max-width: 95%; }
    .audit-log-row { grid-template-columns: 1fr; gap: 0.35rem; }
    .audit-log-row code { white-space: normal; overflow-wrap: anywhere; }
}
