/* ============================================================
   styles.css — Codalata global stylesheet
   ============================================================ */


/* ── Design Tokens ────────────────────────────────────────── */

:root {
    /* Surfaces & backgrounds */
    --bg-page:         #f5f8fc;
    --bg-surface:      #ffffff;
    --bg-surface-alt:  #f0f4fa;

    /* Borders */
    --border-soft:     #e4ecf5;
    --border:          #d9e2ec;
    --border-strong:   #b9c5d6;

    /* Text */
    --text-primary:    #1a2332;
    --text-secondary:  #4a5970;
    --text-muted:      #8190a7;
    --text-inverse:    #ffffff;
    --text-link:       #0056b3;

    /* Brand (primary blue) */
    --color-primary:       #007bff;
    --color-primary-hover: #0056b3;
    --color-primary-soft:  #e8f1ff;

    /* Secondary (neutral button) */
    --color-secondary:       #e4ecf5;
    --color-secondary-hover: #d2dde8;
    --color-secondary-text:  #1a2332;

    /* Accent (create / register) */
    --color-accent:       #2ea548;
    --color-accent-hover: #1e8035;

    /* Success */
    --color-success:        #27a268;
    --color-success-hover:  #1f8553;
    --color-success-soft:   #dff6e8;
    --color-success-border: #9bd7b1;

    /* Warning */
    --color-warning:      #d97e00;
    --color-warning-soft: #fff3e0;

    /* Danger */
    --color-danger:        #d93025;
    --color-danger-hover:  #b3241b;
    --color-danger-soft:   #fdecec;
    --color-danger-border: #f5b9b5;

    /* Focus ring */
    --color-focus: #4c9aff;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(16, 32, 58, 0.06);
    --shadow-md: 0 2px 8px rgba(16, 32, 58, 0.09);
    --shadow-lg: 0 8px 20px rgba(16, 32, 58, 0.14);

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 12px;
    --radius-pill: 999px;

    /* Layout */
    --container-max: 1200px;
    --container-gutter: 24px;
}


/* ── Skip link (a11y) ────────────────────────────────────── */
/* Visible only when focused (keyboard tab from the very top of the page). */
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 1000;
}
.skip-link:focus {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    background: var(--bg-page);
    color: var(--text-primary);
    border: 2px solid var(--accent, #0066cc);
    border-radius: 4px;
    text-decoration: none;
}

/* ── Base & Reset ─────────────────────────────────────────── */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    color: var(--text-primary);
}

h1 { margin: 0; font-size: 24px; }
h2 { margin-top: 0; }


/* ── Layout & Header ──────────────────────────────────────── */

header {
    background-color: var(--color-primary);
    color: var(--text-inverse);
    padding: 8px 0;
    text-align: center;
}

header h1 { font-size: 18px; }
header p  { font-size: 14px; }

.container {
    width: 92%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

/* Site title + breadcrumb trail (left side of header) */
.site-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
    flex: 1 1 0;
}

/* Centered page heading slot inside the header bar */
.site-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
}

.site-page-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-inverse);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

header nav { flex: 1 1 0; display: flex; justify-content: flex-end; }

.site-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
    min-width: 0;
}

.site-breadcrumb .sep {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.95rem;
    user-select: none;
}

.site-breadcrumb a {
    color: var(--text-inverse);
    text-decoration: none;
    opacity: 0.9;
}

.site-breadcrumb a:hover { text-decoration: underline; opacity: 1; }

.site-breadcrumb .current {
    color: var(--text-inverse);
    opacity: 0.75;
    font-weight: 500;
    max-width: 50ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* User menu dropdown (logged-in header) */
.user-menu {
    position: relative;
}

.user-menu-toggle {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: var(--text-inverse);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font: inherit;
    cursor: pointer;
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    line-height: 1;
}

.user-menu-toggle:hover,
.user-menu-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.user-menu-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.18);
}

.user-menu-toggle .caret {
    font-size: 0.7em;
    opacity: 0.85;
    transition: transform 0.15s ease;
}

.user-menu-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }

.user-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 6px;
    display: none;
    z-index: 1000;
}

.user-menu.open .user-menu-panel { display: block; }

.user-menu-panel a,
.user-menu-panel button {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    min-height: 40px;
}

.user-menu-panel a:hover,
.user-menu-panel button:hover,
.user-menu-panel a:focus-visible,
.user-menu-panel button:focus-visible {
    background: var(--color-primary-soft);
    color: var(--text-link);
    outline: none;
}

.user-menu-panel .menu-sep {
    height: 1px;
    background: var(--border-soft);
    margin: 4px 6px;
}

/* Guest login button in header — matches .user-menu-toggle sizing */
.header-login-btn {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: var(--text-inverse);
    text-decoration: none;
    background: transparent;
    min-height: 32px;
    line-height: 1;
}

.header-login-btn:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.header-login-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    text-decoration: none;
}

/* Universal page container — used by every module + root pages.
   Block, centered, capped width, responsive gutter. Historical aliases
   (.content-block, .content-admin) now resolve to the same layout. */
.content {
    display: block;
    width: 100%;
    max-width: var(--container-max);
    margin: 20px auto;
    padding: 0 var(--container-gutter);
    box-sizing: border-box;
}

.user-info {
    text-align: center;
    margin: 20px;
}


/* ── Navigation ───────────────────────────────────────────── */

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li { margin: 0 15px; }

nav ul li a {
    color: white;
    text-decoration: none;
    font-size: 16px;
}

nav ul li a:hover { text-decoration: underline; }

/* Breadcrumb trail */
.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.breadcrumb a { color: var(--text-link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }


/* ── Forms & Inputs ───────────────────────────────────────── */

form {
    width: 300px;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

/* Form field wrapper: label stacked above input */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

input, textarea, select {
    width: 100%;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
}

textarea { resize: vertical; }


/* ── Buttons ──────────────────────────────────────────────── */

button {
    width: 100%;
    padding: 10px;
    background-color: var(--color-primary);
    border: none;
    color: var(--text-inverse);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

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

button:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Inline button that looks like a plain text link */
.link-btn {
    background: none;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    width: auto;
    text-decoration: underline;
}

.link-btn:hover {
    background: none;
    color: var(--color-danger-hover);
}

/* Uniform button system */
.btn {
    display: inline-block;
    padding: 10px 22px;
    background-color: var(--color-primary);
    color: var(--text-inverse);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    width: auto;
}

.btn:hover,
.btn:focus-visible {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: var(--text-inverse);
    outline: none;
    text-decoration: none;
}

.btn-primary        { background-color: var(--color-primary);       border-color: var(--color-primary); }
.btn-primary:hover  { background-color: var(--color-primary-hover); border-color: var(--color-primary-hover); }

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-secondary-text);
    border-color: var(--border);
}
.btn-secondary:hover {
    background-color: var(--color-secondary-hover);
    color: var(--color-secondary-text);
    border-color: var(--border-strong);
}

.btn-accent        { background-color: var(--color-accent);       border-color: var(--color-accent); }
.btn-accent:hover  { background-color: var(--color-accent-hover); border-color: var(--color-accent-hover); }

.btn-success        { background-color: var(--color-success);       border-color: var(--color-success); }
.btn-success:hover  { background-color: var(--color-success-hover); border-color: var(--color-success-hover); }

/* Uniform danger (replaces .btn-danger below) */
.btn.btn-danger         { background-color: var(--color-danger);       border-color: var(--color-danger); color: var(--text-inverse); }
.btn.btn-danger:hover   { background-color: var(--color-danger-hover); border-color: var(--color-danger-hover); }

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}
.btn-outline:hover,
.btn-outline:focus-visible {
    background-color: var(--color-primary);
    color: var(--text-inverse);
}

/* Ghost / text-only */
.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-link);
}
.btn-ghost:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
    border-color: var(--color-primary-soft);
}

/* "Clear" button — looks like secondary but muted */
.btn-clear {
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-clear:hover {
    background-color: var(--color-secondary);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-md { padding: 8px 16px; font-size: 0.95rem; }

/* Close (cancel) button — red circle with white X, absolute top-right of a container */
.close-x-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: var(--color-danger);
    color: var(--text-inverse);
    border: none;
    padding: 0;
    line-height: 1;
    font-size: 18px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: background-color 0.15s, transform 0.1s;
    z-index: 5;
}

.close-x-btn:hover,
.close-x-btn:focus-visible {
    background-color: var(--color-danger-hover);
    color: var(--text-inverse);
    outline: none;
    text-decoration: none;
    transform: scale(1.05);
}

.close-x-btn::before {
    content: "\00D7";
    display: block;
    margin-top: -2px;
}

/* Wrapper that positions a close-x-btn at its top-right */
.has-close-x { position: relative; }


/* ── Feedback Messages ────────────────────────────────────── */

.error {
    color: var(--color-danger);
    background: var(--color-danger-soft);
    border: 1px solid var(--color-danger-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 10px 0;
    text-align: center;
}

.success {
    color: var(--color-success-hover);
    background: var(--color-success-soft);
    border: 1px solid var(--color-success-border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin: 10px 0;
    text-align: center;
}


/* ── Forum Module ──────────────────────────────────── */

.categories, .posts {
    width: 100%;
    background-color: var(--bg-surface);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
}

/* Forum index header row — title left, action buttons right */
.forum-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 16px;
}

/* When the title is gone (centered in site header), push actions to the right */
.forum-header-end { justify-content: flex-end; }

.forum-header .forum-title {
    margin: 0;
    color: var(--text-primary);
}

.forum-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.categories-heading {
    margin-top: 0;
    color: var(--text-primary);
}

.category { margin-bottom: 20px; }

/* Forum layout — left "My Categories" aside + main column */
.forum-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.forum-main { flex: 1 1 auto; min-width: 0; }
.forum-aside {
    flex: 0 0 240px;
    width: 240px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    box-sizing: border-box;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.forum-aside-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.forum-aside-pager button {
    width: auto;
    padding: 4px 10px;
    font-size: 0.85rem;
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin: 0;
}
.forum-aside-pager button:hover:not(:disabled) {
    background: var(--border-soft);
}
.forum-aside-pager button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.forum-aside-list .forum-aside-item.is-hidden { display: none; }
.forum-aside-title {
    margin: 0 0 12px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.forum-aside-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.forum-aside-item { margin: 0; }
.forum-aside-item + .forum-aside-item { margin-top: 4px; }
.forum-aside-item a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.92rem;
}
.forum-aside-item a:hover { background: var(--border-soft); }
.forum-aside-item-active a {
    background: var(--color-primary-soft);
    color: var(--text-link);
    font-weight: 600;
}
.forum-aside-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
@media (max-width: 768px) {
    .forum-layout { flex-direction: column; }
    .forum-aside {
        flex: 1 1 auto;
        width: 100%;
        position: static;
    }
}

/* Wide viewports: push the sidebar into the left gutter outside .content's
   1200px box, without disturbing the main column (transform doesn't affect
   layout flow). Disengages below 1300px so narrow screens stay in-flow. */
@media (min-width: 1300px) {
    .forum-aside {
        transform: translateX(calc((var(--container-max) - 100vw) / 2 - 8px));
    }
}

.post {
    margin-bottom: 20px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
}

/* Single post view — wrapper is block-level, post content spans wide */
.post-wrap {
    display: block;
    max-width: var(--container-max);
    margin: 20px auto;
    padding: 0 var(--container-gutter);
    box-sizing: border-box;
}

.post-content {
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    box-sizing: border-box;
}

/* Post header: left aside (vote stack + edit/delete) | title + meta */
.post-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
}

.post-aside {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.post-header-body { flex: 1; min-width: 0; }

.post-title {
    margin: 0 0 4px;
    font-size: 22px;
    line-height: 1.25;
    word-break: break-word;
}

.post-meta {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.post-body {
    margin: 16px 0;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Post owner actions (Edit / Delete) — stacked under the vote in .post-aside */
.post-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin: 0;
    flex-wrap: wrap;
}

/* ── Vote stack (vertical: ▲ score ▼) ─────────────────────── */
.vote-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0;
    margin: 0;
    flex: 0 0 auto;
    min-width: 32px;
    background: transparent;
    border: 0;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    font-size: 12px;
}
.vote-btn:hover           { color: var(--color-primary); border-color: var(--color-primary); }
.vote-up.is-active        { color: var(--color-accent);  border-color: var(--color-accent);  background: var(--color-success-soft); }
.vote-down.is-active      { color: var(--color-danger);  border-color: var(--color-danger);  background: var(--color-danger-soft); }
.vote-stack-readonly .vote-btn { cursor: default; }

.vote-score {
    font-size: 13px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* ── Threaded comments ────────────────────────────────────── */
.comments-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 0 8px;
}
.comments-meta-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.comments-heading { margin: 0; }
.comments-sort {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}
.comments-sort select {
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
}
.comments-tree    { margin: 0; }

.comment {
    margin: 6px 0;
}

/* Each comment row: vote stack | body. Vote stack hugs the colored left bar
   so it sits flush left within the comment container. */
.comment-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 8px 12px 8px 6px;
    background: var(--bg-surface-alt);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    margin: 0 0 4px;
    color: var(--text-secondary);
    font-size: 13px;
}

.comment-time { color: var(--text-muted); font-style: italic; }

.comment-content {
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}

/* Indentation for nested replies. The inline `--depth` variable is set per node. */
.comment-children {
    margin-left: 24px;
    border-left: 2px solid var(--border-soft);
    padding-left: 8px;
    margin-top: 4px;
}

/* Cap visual indent on narrow screens so deeply-nested threads don't run off. */
@media (max-width: 720px) {
    .comment-children { margin-left: 12px; padding-left: 6px; }
}

/* Inline reply form — hidden by default, JS toggles `hidden` attribute. */
.comment-reply-form {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.comment-reply-form textarea {
    width: 100%;
    min-height: 70px;
    box-sizing: border-box;
}
.comment-reply-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

/* Top-level comment submission form */
.comment-form {
    margin: 12px 0 0;
    padding: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.comment-form textarea {
    width: 100%;
    min-height: 80px;
    box-sizing: border-box;
}

/* Pagination links */
.pagination {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin: 20px 0;
    font-size: 0.9rem;
}

.pagination a {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-link);
    background: var(--bg-surface);
}

.pagination a:hover { background: var(--color-primary-soft); }

.pagination strong {
    padding: 4px 10px;
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: var(--text-inverse);
}


/* ── Dashboard & Module Cards ─────────────────────────────── */

.hero {
    text-align: center;
    padding: 60px 20px 40px;
}

.hero h2 { font-size: 2rem; margin-bottom: 12px; }
.hero p   { color: var(--text-secondary); margin-bottom: 24px; }

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 260px));
    justify-content: center;
    gap: 20px;
    padding: 24px 40px 40px;
    max-width: 1100px;
    margin: 0 auto;
}

.module-card {
    padding: 28px 20px;
    text-align: center;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    max-width: 260px;
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.module-icon svg { color: var(--color-primary); display: block; }

.module-card h3 { margin: 0; font-size: 1rem; font-weight: 600; }

.module-card p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
    text-align: center;
}

/* Module landing page intro paragraph (below <h2>) — centered per global rule */
.content-block > h2 + p { text-align: center; }

/* Paper card utility for centered config panels */
.paper-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    margin: 16px auto;
    max-width: 720px;
}

/* Modifier — centers all body content (text + inline forms + buttons). */
.paper-card-center { text-align: center; }
.paper-card-center > p { text-align: center; }
.paper-card-center .inline-form { display: inline-flex; }


/* ── Shared Utilities ─────────────────────────────────────── */

/* Legacy alias — retained so existing markup (class="content content-block")
   still resolves. Layout now comes from .content. Kept as an empty class so
   the typography selector `.content-block > h2 + p` above continues to work. */
.content-block { /* no-op */ }

.content-narrow {
    max-width: 800px;
    margin: 0 auto;
}

/* Info text (page counts, subtitles) */
.page-info {
    font-size: .9rem;
    color: var(--text-secondary);
}

/* Muted text */
.text-muted { color: var(--text-muted); }
.text-enabled { color: green; }
.text-warning { color: #e07070; }

/* Inline display for inline forms */
.inline {
    display: inline;
    width: auto;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
}

/* Sort header bar */
.sort-bar {
    margin-bottom: .5rem;
    font-size: .9rem;
}

/* Form container — centered form box */
.form-container {
    max-width: 700px;
    margin: 0 auto;
}

/* Monospace data (hashes, keys) */
.mono {
    font-family: monospace;
    font-size: 0.85em;
}

.mono-break {
    font-family: monospace;
    font-size: 0.85em;
    word-break: break-all;
}

/* Stats row (profile counts) */
.stats-row {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
}

/* Permission badges */
.perm-badge {
    display: inline-block;
    background: #e0e0e0;
    padding: 2px 8px;
    border-radius: 3px;
    margin: 2px;
}

.perm-badge-super {
    background: #8b0000;
    color: #fff;
}

.perm-list { margin: 1rem 0; }

/* Collapsible permission disclosure — used in admin users table */
.perm-details > summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    user-select: none;
    padding: 2px 0;
}
.perm-details > summary:hover { color: var(--text-primary); }
.perm-details[open] > summary { margin-bottom: 4px; }
.perm-details-list {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}


/* ── Admin Module ────────────────────────────────────────── */

/* Legacy alias for admin pages — mirrors .content now. */
.content-admin {
    display: block;
    width: 100%;
    max-width: var(--container-max);
    margin: 20px auto;
    padding: 0 var(--container-gutter);
    box-sizing: border-box;
}

.admin-section { margin-bottom: 2.5rem; }

.admin-section-title {
    text-align: center;
    margin: 0 0 1rem;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.admin-paper-card { max-width: 900px; }

/* Pending-approvals worklist (SA-only) */
.admin-pending-card { max-width: 1100px; }

.admin-pending-count {
    display: inline-block;
    background: var(--color-danger);
    color: #fff;
    border-radius: 999px;
    padding: 1px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}

.admin-pending-table { width: 100%; }
.admin-pending-table th,
.admin-pending-table td { vertical-align: middle; }

.admin-pending-actions {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 240px;
}
.admin-pending-actions .inline { margin: 0; }
.admin-pending-actions .inline + .inline { margin-left: 0; }

/* Bulk toolbar — same flex pattern, sits above the table. */
.admin-pending-bulk {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.admin-pending-bulk .inline { margin: 0; }

/* Pending state (per-row OR bulk) — Confirm button is pinned to the far right. */
.admin-pending-actions-pending .admin-pending-confirm-btn,
.admin-pending-bulk.admin-pending-actions-pending .admin-pending-confirm-btn {
    margin-left: auto;
}

/* Row-removal fade (driven by JS adding .admin-pending-removing). */
.admin-pending-table tbody tr {
    transition: opacity 220ms ease, transform 220ms ease;
}
.admin-pending-removing {
    opacity: 0;
    transform: translateX(8px);
}

/* Inline error banner inside the pending card — slot just under the heading. */
.admin-pending-error {
    margin: 0 0 12px;
    white-space: pre-wrap;
}

.admin-tools { margin: 0 0 1.5rem; text-align: center; }

/* Admin edit controls injected into profile.php */
.admin-profile-controls {
    background: var(--color-primary-soft);
    border: 1px solid var(--border);
    max-width: 100%;
}

.admin-profile-controls .admin-section-title { text-align: center; }

.admin-profile-form {
    margin: 0 auto 1.25rem;
    max-width: 480px;
    width: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}
.admin-profile-form .form-group { margin-bottom: 12px; }
.admin-profile-form input { margin-bottom: 0; }
.admin-profile-form button { display: block; margin: 12px auto 0; width: auto; }

.admin-profile-perm-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin: 0 0 1rem;
}

.admin-profile-danger {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    text-align: right;
}

/* Test email form — compact, centered */
.test-email-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    background: none;
    border: none;
}
.test-email-form label { font-size: 0.9rem; color: var(--text-secondary); }
.test-email-form input {
    width: auto;
    min-width: 220px;
    max-width: 300px;
    padding: 6px 10px;
    margin: 0;
    font-size: 0.9rem;
}
.test-email-form .btn { width: auto; }

.test-email-hint { text-align: center; margin-top: 0.5rem; }

/* Log viewer day-picker */
.log-viewer-card { max-width: 1100px; }
.log-viewer-picker {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    width: auto;
    margin: 0 auto 1rem;
    padding: 0;
    background: none;
    border: none;
}
.log-viewer-picker label { font-size: 0.9rem; color: var(--text-secondary); }
.log-viewer-picker select {
    width: auto;
    padding: 6px 10px;
    margin: 0;
    font-size: 0.9rem;
}

/* Universal compact filter bar (partials/filter_bar.php) */
.filter-bar-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    width: auto;
    max-width: 100%;
    margin: 0 0 1rem;
    padding: 6px 0;
    background: none;
    border: none;
    border-radius: 0;
}
.filter-bar-compact input,
.filter-bar-compact select {
    width: auto;
    padding: 6px 10px;
    margin: 0;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
}
.filter-bar-compact input[type="text"] { min-width: 200px; }
.filter-bar-compact .filter-bar-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.filter-bar-compact .btn-sm { width: auto; }

.admin-section table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.admin-section th,
.admin-section td { padding: 8px 8px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.admin-section th { background: var(--bg-surface-alt); }
.admin-section th a { color: inherit; text-decoration: none; }
.admin-section th a:hover { text-decoration: underline; }

.perm-form {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    width: auto;
    margin: 2px 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
}
.perm-form select,
.perm-form button { width: auto; margin: 0; vertical-align: middle; }
.perm-form select { min-height: 32px; padding: 4px 8px; }
.perm-form .btn-sm { min-height: 32px; line-height: 1.2; }

.msg-success { padding: 8px 12px; margin-bottom: 1rem; background: #dfd; border: 1px solid #9c9; border-radius: 4px; }
.msg-error   { padding: 8px 12px; margin-bottom: 1rem; background: #fdd; border: 1px solid #c99; border-radius: 4px; }

.log-box {
    background: #111; color: #eee; font-family: monospace; font-size: .8rem;
    padding: 1rem; border-radius: 4px; max-height: 400px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all;
}
.log-INFO  { color: #8f8; }
.log-WARN  { color: #ff8; }
.log-ERROR { color: #f88; }

.toggle-row { display: flex; align-items: center; gap: 1rem; margin: .5rem 0; }

.row-deleted { opacity: 0.5; }


/* ── Rasp Module: Camera ─────────────────────────────────── */

.rasp-wrap { background: #111; color: #eee; padding: 20px; }
.rasp-wrap button { padding: 10px 12px; cursor: pointer; width: auto; }

.rasp-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }

.rasp-panel { background: #1a1a1a; border-radius: 8px; padding: 16px; }
.rasp-main  { flex: 1 1 500px; min-width: 300px; }
.rasp-side  { flex: 0 0 420px; }

#image-display {
    width: 80%;
    max-width: 800px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin: 10px 0;
    min-height: 480px;
    height: auto;
    display: block;
    background: #000;
    object-fit: contain;
}
#status { background: #000; color: #0f0; min-height: 280px; padding: 10px; overflow: auto; white-space: pre-wrap; }

.rasp-frame { position: relative; display: inline-block; width: 80%; max-width: 800px; }
.rasp-frame #image-display { width: 100%; max-width: none; margin: 0; }
.rasp-overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    background: rgba(0, 0, 0, 0.65); color: #eee; border-radius: 8px;
    font-size: 0.95em; letter-spacing: 0.02em;
}
.rasp-overlay.hidden { display: none; }
.rasp-spinner {
    width: 48px; height: 48px; border: 4px solid #333; border-top-color: #8af;
    border-radius: 50%; animation: rasp-spin 0.9s linear infinite;
}
@keyframes rasp-spin { to { transform: rotate(360deg); } }
.rasp-indicator {
    position: absolute; top: 10px; right: 10px;
    padding: 4px 10px; border-radius: 12px; font-size: 0.8em; font-weight: 600;
    letter-spacing: 0.04em; text-transform: uppercase;
    background: rgba(0, 0, 0, 0.6);
}
.rasp-indicator::before {
    content: ''; display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; margin-right: 6px; vertical-align: middle;
}
.rasp-indicator-live { color: #9f9; }
.rasp-indicator-live::before { background: #2ecc40; box-shadow: 0 0 6px #2ecc40; }
.rasp-indicator-idle { color: #aaa; }
.rasp-indicator-idle::before { background: #888; }

.rasp-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.pad-grid { display: grid; grid-template-columns: repeat(3, minmax(90px, 1fr)); gap: 8px; }

.rasp-breadcrumb { margin-bottom: 12px; }
.rasp-breadcrumb a { color: #8af; }
.rasp-breadcrumb .sep { color: #666; margin: 0 8px; }

.rasp-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.rasp-gallery-item { margin: 0; background: #0d0d0d; border-radius: 6px; overflow: hidden; }
.rasp-gallery-item a { display: block; }
.rasp-gallery-item img { width: 100%; height: 180px; object-fit: cover; display: block; background: #000; }
.rasp-gallery-item figcaption {
    padding: 6px 8px; font-size: 0.8em; color: #aaa;
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}

/* ── Rasp Module: 24 Hour Timeline (light, global tokens) ── */
.timeline-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 16px; margin-bottom: 16px;
}
.timeline-title { margin: 0; }
.timeline-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.timeline-actions .btn { white-space: nowrap; }

.timeline-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.timeline-tile {
    margin: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.timeline-tile a { display: block; }
.timeline-tile img {
    width: 100%; height: 220px; object-fit: cover;
    display: block; background: #000;
}
.timeline-tile figcaption {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.9em;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}
.timeline-tile .timeline-time { grid-column: 2; text-align: center; }
.timeline-tile form.inline { grid-column: 3; justify-self: end; margin: 0; }


/* ── Rasp Module: Device List ────────────────────────────── */

.device-table { width: 100%; border-collapse: collapse; margin-bottom: 24px; margin-top: 16px; }
.device-table thead tr { border-bottom: 2px solid #444; }
.device-table th { text-align: left; padding: 8px 10px; }
.device-table tbody tr { border-bottom: 1px solid #333; }
.device-table td { padding: 10px; }
.device-table .last-seen { font-size: 0.9em; color: #aaa; }

.device-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.btn-device {
    padding: 5px 10px; color: #fff; border: none; border-radius: 4px;
    cursor: pointer; font-size: 0.85em; text-decoration: none; display: inline-block; width: auto;
}
.btn-device-view  { background: #1a6fbf; }
.btn-device-pictures { background: #4a3b8f; }
.btn-device-timeline { background: #3a5b7a; }
.btn-device-install { background: #1f7a3a; }
.btn-device-regen { background: #7a5c00; }
.btn-device-remove { background: #7a1e1e; }
.btn-device-share { background: #1f6c6c; }
.btn-device-disabled { opacity: 0.4; cursor: not-allowed; }

.btn-device:hover {background-color: #007bff; color: white;}

.badge-access {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
}
.badge-owner  { background: #1f5e8f; }
.badge-shared { background: #6c4a7a; }

.device-add-section { border-top: 1px solid #444; padding-top: 20px; }
.device-add-section h3 { margin-top: 0; }
.device-list-section { margin-top: 24px; }
.device-list-section h3 { margin: 0 0 12px; }
.rate-limit-label { font-size: 0.75em; font-weight: normal; color: #888; margin-left: 8px; }

.device-add-form {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
    width: auto; margin: 0; padding: 0; background: none; border: none;
}
.device-add-form > div { display: flex; flex-direction: column; margin: 0; }
.device-add-form label { display: block; margin-bottom: 4px; font-size: 0.9em; }
.device-add-form input,
.device-add-form select { width: 220px; margin: 0; height: 40px; box-sizing: border-box; }
.device-add-form button { padding: 0 18px; width: auto; height: 40px; margin: 0; line-height: 1; }

/* ── Install Page (rasp) ─────────────────────────────────── */

.copy-btn { width: auto; }
.copy-btn.copied,
.copy-btn.copied:hover {
    background-color: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}

.install-info {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 8px 12px;
    margin: 0 0 16px 0;
}
.install-info dt {
    font-weight: 600;
    color: var(--color-secondary-text);
}
.install-info dd {
    margin: 0;
    word-break: break-all;
}
.install-info dd .copy-btn {
    margin-left: 8px;
    vertical-align: middle;
}

.install-label {
    margin: 16px 0 4px 0;
    font-weight: 600;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.install-cmd-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 8px;
}
.install-cmd-row .copy-btn {
    flex-shrink: 0;
    align-self: flex-start;
    margin: 0;
}

.install-cmd {
    flex: 1;
    min-width: 0;
    background: var(--color-secondary);
    color: var(--color-secondary-text);
    border: 1px solid var(--color-secondary-hover);
    border-radius: 4px;
    padding: 10px 14px;
    margin: 0;
    font-family: monospace;
    font-size: 0.85em;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-x: auto;
}


/* ── Utility Classes ─────────────────────────────────────── */

.text-center { text-align: center; }
.hidden { display: none; }
.form-footer { margin-top: 1rem; text-align: center; }

/* Site title link — favicon + wordmark inside one home link */
.site-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}
.site-title h1 { margin: 0; line-height: 1; }
.site-favicon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: block;
}



/* Auth form container (login/register — narrower) */
.form-container-narrow {
    max-width: 400px;
    margin: 2rem auto;
}

/* Login page — Login / Forgot / Register row */
.login-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
}

.login-action-btn {
    flex: 1 1 140px;
    text-align: center;
    padding: 10px 16px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-forgot {
    display: flex;
    justify-content: flex-end;
    font-size: 0.7rem;
    color: var(--text-link);
    text-decoration: none;
    margin-top: 0px;
}

.login-forgot:hover { text-decoration: underline; }


/* ── Media Queries ────────────────────────────────────────── */

@media (max-width: 768px) {
    .container {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .site-left { flex: 1 1 auto; }

    nav ul { flex-direction: row; flex-wrap: wrap; }
    nav ul li { margin: 0 8px; }

    .content { padding: 0 16px; }

    .categories, .posts { width: 100%; margin-bottom: 20px; }


    .site-breadcrumb { font-size: 0.85rem; }
    .site-breadcrumb .current { max-width: 20ch; }

    /* Mobile: favicon-only logo, left-aligned. Wordmark + page title + breadcrumbs hidden. */
    .site-title h1 { display: none; }
    .site-breadcrumb { display: none; }
    .site-page-title { display: none; }
    .site-center { display: none; }

    .user-menu-panel {
        right: 0;
        left: auto;
        min-width: 180px;
    }
}

@media (max-width: 480px) {
    .site-breadcrumb { display: none; }
}

@media (max-width: 600px) {
    .module-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
        gap: 14px;
    }
}


/* ── Forum Category Badges + Metadata View ───────────────── */

.cat-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 6px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    vertical-align: middle;
    border: 1px solid transparent;
    white-space: nowrap;
}

.cat-badge-private {
    background: var(--color-warning-soft);
    color: var(--color-warning);
    border-color: var(--color-warning);
}

.cat-badge-disabled {
    background: var(--color-danger-soft);
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}

.cat-metadata-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
}

.cat-metadata-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin: 16px 0;
    text-align: center;
}

.cat-metadata-card .cat-metadata-badges { justify-content: center; }

.cat-metadata-name {
    margin: 0 0 8px;
    color: var(--text-primary);
}

.cat-metadata-description {
    margin: 0 0 12px;
    color: var(--text-secondary);
}

.cat-metadata-counts {
    margin: 0 0 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.cat-metadata-cta { margin: 0; }

.cat-metadata-cta button[disabled] {
    width: auto;
    cursor: not-allowed;
    opacity: 0.6;
}

.cat-disabled-panel {
    background: var(--color-danger-soft);
    border: 1px solid var(--color-danger-border);
    color: var(--color-danger);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 12px 0;
    text-align: center;
}

.cat-watermark {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

.radio-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.radio-inline input[type="radio"] {
    width: auto;
    margin: 0;
    padding: 0;
}

.form-group-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-help {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}


/* ── Forum Management Panel ─────────────────────────────── */

.manage-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin: 0 0 16px;
}

.manage-tab {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
    background: var(--bg-surface-alt);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
}

.manage-tab:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.manage-tab-active {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 600;
    border-bottom: 1px solid var(--bg-surface);
    margin-bottom: -1px;
}

.manage-tab-back {
    margin-left: auto;
    background: transparent;
    border-color: transparent;
}

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

.manage-stats li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-primary);
}

.manage-stats li:last-child { border-bottom: none; }

.manage-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
}

.manage-table th,
.manage-table td {
    padding: 8px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.manage-table th {
    background: var(--bg-surface-alt);
    color: var(--text-primary);
}

.manage-actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: auto;
    margin: 0;
    padding: 0;
    background: none;
    border: none;
}

.transfer-form select { width: auto; margin: 0; }

.cat-badge-public {
    background: var(--color-primary-soft);
    color: var(--color-primary-hover);
    border-color: var(--color-primary);
}

.cat-badge-role {
    background: var(--bg-surface-alt);
    color: var(--text-secondary);
    border-color: var(--border);
}

/* ── Per-author role tag ([A] for OWNER, [M] for MANAGER) ──── */
.cat-author-tag {
    display: inline-block;
    padding: 0 4px;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.4;
    vertical-align: middle;
}

.cat-author-tag-owner {
    background: var(--color-primary);
    color: var(--text-inverse);
}

.cat-author-tag-manager {
    background: var(--color-accent);
    color: var(--text-inverse);
}
