/* ============================================================
   Dino KB — Modern public-site design system
   ============================================================ */

:root {
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-surface-alt: #f1f5f9;
    --color-border: #e2e8f0;
    --color-border-strong: #cbd5e1;
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-text-soft: #94a3b8;

    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-primary-soft: #eef2ff;
    --color-accent: #fb5001;
    --color-accent-hover: #e04500;
    --color-accent-soft: rgba(251, 80, 1, 0.08);

    --header-bg: rgba(255, 255, 255, 0.85);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;

    --header-height: 84px;
    --sidebar-width: 280px;
    --max-content: 1200px;
}

[data-theme="dark"] {
    --color-bg: #0b1220;
    --color-surface: #111827;
    --color-surface-alt: #1f2937;
    --color-border: #1f2937;
    --color-border-strong: #374151;
    --color-text: #e5e7eb;
    --color-text-muted: #9ca3af;
    --color-text-soft: #6b7280;

    --color-primary: #818cf8;
    --color-primary-hover: #a5b4fc;
    --color-primary-soft: #1e1b4b;
    --color-accent: #fb7c3a;
    --color-accent-hover: #fb9252;
    --color-accent-soft: rgba(251, 124, 58, 0.12);

    --header-bg: rgba(17, 24, 39, 0.85);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover { color: var(--color-primary-hover); }

h1, h2, h3, h4, h5, h6 {
    color: var(--color-text);
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 0.5em 0;
}

h1 { font-size: 2rem; letter-spacing: -0.02em; }
h2 { font-size: 1.5rem; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

img { max-width: 100%; height: auto; }

/* ---------- App shell ---------- */

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

.sidebar-overlay { display: none; }

/* ---------- Sidebar ---------- */

.app-sidebar {
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.app-sidebar__brand {
    height: var(--header-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.app-sidebar__brand a {
    display: inline-flex;
    align-items: center;
}

.app-sidebar__brand img {
    max-height: 56px;
    width: auto;
}

.app-sidebar__close {
    display: none;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.app-sidebar__close:hover { background: var(--color-surface-alt); }

.app-sidebar__nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-tree,
.nav-tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-tree li { margin: 2px 0; }

.nav-tree__link,
.nav-tree__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-family: inherit;
}

.nav-tree__link:hover,
.nav-tree__toggle:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary);
}

.nav-tree__link.is-active {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.nav-tree__caret {
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform 0.2s ease;
    color: var(--color-text-muted);
}

.nav-tree__toggle[aria-expanded="true"] .nav-tree__caret {
    transform: rotate(90deg);
}

.nav-tree__children {
    padding-left: 16px;
    margin-top: 2px;
    border-left: 1px solid var(--color-border);
    margin-left: 16px;
    display: none;
}

.nav-tree__toggle[aria-expanded="true"] + .nav-tree__children {
    display: block;
}

/* ---------- Main column ---------- */

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* ---------- Header ---------- */

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--color-border);
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
}

.app-header__menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
}

.app-header__menu:hover { background: var(--color-surface-alt); }

.app-header__search {
    flex: 1;
    max-width: 560px;
    position: relative;
}

.app-header__search input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 42px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
    font-size: 0.9rem;
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-family: inherit;
}

.app-header__search input:focus {
    border-color: var(--color-primary);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.app-header__search svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-soft);
    pointer-events: none;
}

.app-header__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Language switcher */

.lang-menu { position: relative; }

.lang-menu__button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    font-family: inherit;
    transition: background 0.15s ease;
}

.lang-menu__button:hover { background: var(--color-surface); border-color: var(--color-border-strong); }

.lang-menu__dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    z-index: 20;
}

.lang-menu.is-open .lang-menu__dropdown { display: block; }

.lang-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.875rem;
}

.lang-menu__item:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary);
}

.lang-menu__item img {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
}

/* ---------- Main content ---------- */

.app-content {
    flex: 1;
    padding: 32px 40px;
    width: 100%;
}

.page-header {
    margin-bottom: 28px;
}

.page-header__eyebrow {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    margin-bottom: 6px;
}

.page-header h1 {
    margin: 0;
}

.page-header__subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-top: 8px;
}

/* ---------- Breadcrumb ---------- */

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--color-text-muted);
}

.breadcrumb a:hover { color: var(--color-primary); }

.breadcrumb__sep {
    color: var(--color-text-soft);
}

.breadcrumb__current {
    color: var(--color-text);
    font-weight: 500;
}

/* ---------- Card grid (content listing) ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.content-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    color: inherit;
}

.content-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-border-strong);
    color: inherit;
}

.content-card__title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    line-height: 1.4;
}

.content-card__summary {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.content-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.content-card__category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-card__views {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* ---------- Empty state ---------- */

.empty-state {
    background: var(--color-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    color: var(--color-text-muted);
}

.empty-state h2 {
    color: var(--color-text);
    font-size: 1.15rem;
    margin-bottom: 6px;
}

/* ---------- Article (OpenContentCat) ---------- */

.article {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px 48px;
    box-shadow: var(--shadow-sm);
}

.article__header {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 28px;
}

.article__title {
    font-size: 2.25rem;
    letter-spacing: -0.02em;
    margin: 0 0 12px 0;
}

.article__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.article__body {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-text);
    word-wrap: break-word;
}

.article__body h1,
.article__body h2,
.article__body h3,
.article__body h4 {
    margin-top: 1.6em;
    scroll-margin-top: calc(var(--header-height) + 16px);
    position: relative;
}

.heading-anchor {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 8px;
    padding: 0;
    color: var(--color-text-soft);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    vertical-align: middle;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.article__body h2:hover .heading-anchor,
.article__body h3:hover .heading-anchor,
.article__body h4:hover .heading-anchor {
    opacity: 1;
}

.heading-anchor:hover {
    color: var(--color-primary);
    background: var(--color-primary-soft);
}

.heading-anchor.is-copied {
    color: var(--color-primary);
    opacity: 1;
}

.article__body p { margin: 0 0 1em 0; }

.article__body img {
    border-radius: var(--radius-md);
    margin: 1em 0;
}

.article__body pre {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-size: 0.875rem;
}

.article__body code {
    background: var(--color-surface-alt);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.article__body pre code {
    background: none;
    padding: 0;
}

.article__body blockquote {
    border-left: 3px solid var(--color-primary);
    padding: 8px 20px;
    margin: 1em 0;
    color: var(--color-text-muted);
    background: var(--color-primary-soft);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ---------- Callout / admonition boxes ---------- */

.article__body .callout,
.article__body blockquote.info,
.article__body blockquote.warning,
.article__body blockquote.tip,
.article__body blockquote.danger {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    margin: 1.25em 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    border-left-width: 4px;
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.article__body .callout::before,
.article__body blockquote.info::before,
.article__body blockquote.warning::before,
.article__body blockquote.tip::before,
.article__body blockquote.danger::before {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    font-size: 16px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    color: #fff;
}

.article__body blockquote.info,
.article__body .callout.info {
    border-left-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}
.article__body blockquote.info::before,
.article__body .callout.info::before {
    content: "i";
    background: #3b82f6;
    font-family: Georgia, serif;
    font-style: italic;
}

.article__body blockquote.tip,
.article__body .callout.tip {
    border-left-color: #10b981;
    background: rgba(16, 185, 129, 0.08);
}
.article__body blockquote.tip::before,
.article__body .callout.tip::before {
    content: "\2713";
    background: #10b981;
}

.article__body blockquote.warning,
.article__body .callout.warning {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}
.article__body blockquote.warning::before,
.article__body .callout.warning::before {
    content: "!";
    background: #f59e0b;
}

.article__body blockquote.danger,
.article__body .callout.danger {
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}
.article__body blockquote.danger::before,
.article__body .callout.danger::before {
    content: "\00D7";
    background: #ef4444;
    font-size: 20px;
}

.article__body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.article__body th,
.article__body td {
    border: 1px solid var(--color-border);
    padding: 10px 14px;
    text-align: left;
}

.article__body th {
    background: var(--color-surface-alt);
    font-weight: 600;
}

/* ---------- Footer ---------- */

.app-footer {
    padding: 24px 32px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 50;
        box-shadow: var(--shadow-lg);
    }

    .app-shell.is-sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    .app-sidebar__close { display: inline-flex; }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.4);
        z-index: 40;
    }

    .app-shell.is-sidebar-open .sidebar-overlay { display: block; }

    .app-header__menu { display: inline-flex; }

    .app-content { padding: 20px; }

    .article { padding: 24px 20px; }

    .article__title { font-size: 1.6rem; }
}

@media (max-width: 560px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    .lang-menu__button span { display: none; }

    .app-header { padding: 0 16px; gap: 8px; }
}

/* ---------- Reading progress bar ---------- */

.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 100;
    pointer-events: none;
}

.reading-progress__fill {
    height: 100%;
    width: 0%;
    background: var(--color-primary);
    transition: width 0.08s linear;
}

/* ---------- Search kbd hint ---------- */

.app-header__kbd {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    gap: 3px;
    pointer-events: none;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.app-header__kbd kbd {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.7rem;
    box-shadow: 0 1px 0 var(--color-border);
}

.app-header__search.is-focused .app-header__kbd { display: none; }

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

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
}

.theme-toggle:hover {
    background: var(--color-surface);
    border-color: var(--color-border-strong);
}

.theme-toggle svg { display: block; }

.theme-toggle__sun { display: none; }
.theme-toggle__moon { display: block; }

[data-theme="dark"] .theme-toggle__sun { display: block; }
[data-theme="dark"] .theme-toggle__moon { display: none; }

/* ---------- Article layout with TOC ---------- */

.article-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 48px;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}

.article-toc {
    position: sticky;
    top: calc(var(--header-height) + 20px);
    padding: 20px 0;
    border-left: 1px solid var(--color-border);
    padding-left: 20px;
    max-height: calc(100vh - var(--header-height) - 40px);
    overflow-y: auto;
}

.article-toc__title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.article-toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.article-toc li { margin: 0; }

.article-toc__link {
    display: block;
    padding: 6px 12px 6px 10px;
    margin-left: -11px;
    border-left: 2px solid transparent;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.article-toc__link:hover { color: var(--color-text); }

.article-toc__link.is-active {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 500;
}

.article-toc__link--h3 {
    padding-left: 22px;
    font-size: 0.8rem;
}

/* Hide TOC when it has no items */
.article-layout.no-toc {
    grid-template-columns: minmax(0, 1fr);
    max-width: 1200px;
}

.article-layout.no-toc .article-toc { display: none; }

@media (max-width: 1100px) {
    .article-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .article-toc { display: none; }
}

/* ---------- Prev / next article nav ---------- */

.article-nav {
    margin-top: 32px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.article-nav__item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 22px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    color: inherit;
    transition: border-color 0.15s ease, transform 0.2s ease;
}

.article-nav__item:hover {
    border-color: var(--color-border-strong);
    transform: translateY(-2px);
    color: inherit;
}

.article-nav__label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    font-weight: 600;
}

.article-nav__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
}

.article-nav__item--next {
    text-align: right;
    align-items: flex-end;
}

.article-nav__item--prev + :not(.article-nav__item--next) { display: none; }

@media (max-width: 640px) {
    .article-nav { grid-template-columns: 1fr; }
    .article-nav__item--next { text-align: left; align-items: flex-start; }
}

/* ---------- Code blocks + copy button ---------- */

.article__body pre {
    position: relative;
    padding-top: 44px !important;
}

.code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    opacity: 0;
    transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.article__body pre:hover .code-copy { opacity: 1; }

.code-copy:hover {
    color: var(--color-text);
    background: var(--color-surface-alt);
}

.code-copy.is-copied {
    color: var(--color-primary);
    opacity: 1;
}

/* Highlight.js theme tweaks to blend with our surface */
.hljs {
    background: var(--color-surface-alt) !important;
    color: var(--color-text) !important;
}

/* ============================================================
   Mega-pack additions
   ============================================================ */

/* ---------- Skip to content link (a11y) ---------- */

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    background: var(--color-primary);
    color: #fff;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    z-index: 200;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: 16px;
    color: #fff;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ---------- Focus visible rings (a11y) ---------- */

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.content-card:focus-visible,
.article-nav__item:focus-visible {
    outline-offset: 4px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ---------- Home hero ---------- */

.hero {
    padding: 56px 24px 40px;
    text-align: center;
    background: radial-gradient(ellipse at top, var(--color-primary-soft) 0%, transparent 60%),
                radial-gradient(ellipse at bottom right, var(--color-accent-soft) 0%, transparent 55%);
    border-radius: var(--radius-lg);
    margin-bottom: 40px;
    border: 1px solid var(--color-border);
}

.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    margin-bottom: 14px;
}

.hero__eyebrow::before,
.hero__eyebrow::after {
    content: "";
    width: 24px;
    height: 1px;
    background: currentColor;
    opacity: 0.6;
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    letter-spacing: -0.025em;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.hero__subtitle {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

.hero__search {
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

.hero__search input {
    width: 100%;
    height: 52px;
    padding: 0 20px 0 50px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    font-size: 1rem;
    color: var(--color-text);
    font-family: inherit;
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.hero__search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px var(--color-primary-soft);
}

.hero__search svg {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-soft);
    pointer-events: none;
}

/* ---------- Category icons in sidebar ---------- */

.nav-tree__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: var(--color-text-soft);
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.nav-tree__toggle:hover .nav-tree__icon,
.nav-tree__link:hover .nav-tree__icon,
.nav-tree__toggle[aria-expanded="true"] .nav-tree__icon {
    color: var(--color-accent);
}

.nav-tree__link.is-active .nav-tree__icon {
    color: var(--color-primary);
}

/* ---------- Toast notifications ---------- */

.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    font-weight: 500;
    min-width: 180px;
    max-width: 360px;
    pointer-events: auto;
    transform: translateX(20px);
    opacity: 0;
    animation: toast-in 0.25s ease forwards;
}

.toast.is-leaving {
    animation: toast-out 0.2s ease forwards;
}

.toast--success { border-left-color: #10b981; }
.toast--error { border-left-color: #ef4444; }
.toast--info { border-left-color: var(--color-primary); }

@keyframes toast-in {
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    to { transform: translateX(20px); opacity: 0; }
}

/* ---------- Article watch button ---------- */

.header-website-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: background .12s ease, color .12s ease;
}

.header-website-link:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary, #2c3e7c);
}

@media (max-width: 720px) {
    .header-website-link span { display: none; }
}

.article__watch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    margin-left: 8px;
    border: 1px solid #2db83d;
    border-radius: 4px;
    background: #fff;
    color: #2db83d;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: background .15s ease, color .15s ease;
}

.article__watch:hover {
    background: #2db83d;
    color: #fff;
}

[data-theme="dark"] .article__watch {
    background: rgba(45, 184, 61, 0.12);
    color: #6ddd7c;
    border-color: rgba(45, 184, 61, 0.5);
}
[data-theme="dark"] .article__watch:hover {
    background: #2db83d;
    color: #fff;
}

/* ---------- Back to top ---------- */

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
    z-index: 40;
}

.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-border-strong);
}

/* ---------- Image lightbox ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.88);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 40px;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.lightbox.is-open {
    display: flex;
    opacity: 1;
}

.lightbox__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    cursor: default;
}

.lightbox__close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox__close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.article__body img {
    cursor: zoom-in;
    transition: transform 0.15s ease;
}

.article__body img:hover {
    transform: scale(1.01);
}

/* ---------- Table polish ---------- */

.article__body table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.5em 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    font-size: 0.9rem;
}

.article__body th,
.article__body td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    border-right: none;
    border-top: none;
    border-left: none;
    text-align: left;
}

.article__body thead th {
    background: var(--color-surface-alt);
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}

.article__body tbody tr:nth-child(even) td {
    background: var(--color-surface-alt);
}

.article__body tbody tr:hover td {
    background: var(--color-primary-soft);
}

.article__body tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- Step numbering for ordered lists ---------- */

.article__body ol.steps,
.article__body .steps ol,
.article__body ol[type="step"] {
    list-style: none;
    counter-reset: step-counter;
    padding-left: 0;
    margin: 1.5em 0;
}

.article__body ol.steps > li,
.article__body .steps ol > li {
    counter-increment: step-counter;
    position: relative;
    padding: 16px 20px 16px 64px;
    margin: 10px 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    min-height: 56px;
}

.article__body ol.steps > li::before,
.article__body .steps ol > li::before {
    content: counter(step-counter);
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

/* ---------- Responsive iframe / video wrapper ---------- */

.article__body iframe,
.article__body video {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    border: 0;
    border-radius: var(--radius-md);
    margin: 1.5em 0;
}

/* ---------- View Transitions API (modern browsers) ---------- */

@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.22s;
}

/* ---------- Error pages (404 / 500) ---------- */

.error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px;
    min-height: 60vh;
}

.error-page__code {
    font-size: clamp(5rem, 12vw, 8rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0 0 16px;
}

.error-page__title {
    font-size: 1.75rem;
    margin: 0 0 12px;
}

.error-page__message {
    color: var(--color-text-muted);
    font-size: 1rem;
    max-width: 520px;
    margin: 0 auto 28px;
}

.error-page__actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    font-family: inherit;
}

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

.btn--ghost {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border-strong);
}
.btn--ghost:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

/* ---------- Command palette ---------- */

.cmdk {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    z-index: 900;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.cmdk.is-open {
    display: flex;
    opacity: 1;
}

.cmdk__dialog {
    width: min(640px, 92vw);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.cmdk__input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.cmdk__input-wrap svg {
    color: var(--color-text-soft);
    flex-shrink: 0;
}

.cmdk__input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    color: var(--color-text);
    font-family: inherit;
}

.cmdk__input::placeholder { color: var(--color-text-soft); }

.cmdk__hint {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 600;
}

.cmdk__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    margin: 0;
    list-style: none;
}

.cmdk__section {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--color-text-muted);
    padding: 10px 12px 6px;
}

.cmdk__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.12s ease;
}

.cmdk__item:hover,
.cmdk__item.is-focused {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.cmdk__item-title {
    font-size: 0.9rem;
    font-weight: 500;
}

.cmdk__item-sub {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.cmdk__empty {
    padding: 32px 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.cmdk__footer {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--color-border);
    font-size: 0.72rem;
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
}

.cmdk__footer kbd {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    margin-right: 4px;
}

/* ---------- Preview mode banner ---------- */

.preview-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fcd34d;
    font-size: 0.85rem;
    font-weight: 500;
}

[data-theme="dark"] .preview-banner {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-bottom-color: rgba(245, 158, 11, 0.3);
}

.preview-banner svg { flex-shrink: 0; }

.preview-banner strong { font-weight: 700; }

.draft-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

[data-theme="dark"] .draft-chip {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
}

.article__meta .draft-chip {
    margin-left: 4px;
}

/* ---------- Admin toolbar (floating) ---------- */

.admin-dock {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    padding: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    box-shadow: var(--shadow-lg);
    z-index: 80;
}

.admin-dock__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text);
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.admin-dock__btn:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.admin-dock__btn--primary {
    background: var(--color-primary);
    color: #fff;
}

.admin-dock__btn--primary:hover {
    background: var(--color-primary-hover);
    color: #fff;
}

.admin-dock__sep {
    width: 1px;
    background: var(--color-border);
    margin: 4px 2px;
}

/* ---------- Changelog / sitemap pages ---------- */

.timeline {
    max-width: 820px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.timeline__item {
    position: relative;
    padding: 20px 0 20px 32px;
    border-left: 2px solid var(--color-border);
    margin-left: 16px;
}

.timeline__item::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 26px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary);
    border: 2px solid var(--color-surface);
    box-shadow: 0 0 0 2px var(--color-border);
}

.timeline__card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    display: block;
    color: inherit;
    transition: border-color 0.15s ease;
}

.timeline__card:hover {
    border-color: var(--color-border-strong);
    color: inherit;
}

.timeline__title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--color-text);
}

.timeline__meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

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

.sitemap-tree ul {
    list-style: none;
    padding-left: 22px;
    margin: 4px 0 10px;
    border-left: 1px dashed var(--color-border);
}

.sitemap-tree li {
    margin: 6px 0;
}

.sitemap-tree__cat {
    font-weight: 600;
    color: var(--color-text);
    display: inline-block;
    padding: 3px 0;
}

.sitemap-tree__content {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.sitemap-tree__content:hover {
    color: var(--color-primary);
}

/* ---------- Category description block ---------- */

.category-description {
    padding: 18px 22px;
    background: var(--color-primary-soft);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 24px;
}

.category-description p:first-child { margin-top: 0; }
.category-description p:last-child { margin-bottom: 0; }

/* ---------- Report issue link ---------- */

.report-issue {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    padding: 8px 0;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

.report-issue:hover { color: var(--color-primary); }

/* ============================================================
   Admin panel components
   ============================================================ */

/* ---------- Admin forms ---------- */

.admin-page {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-page--narrow {
    max-width: 760px;
}

.admin-page__title {
    margin: 0 0 24px;
}

.admin-help {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 16px;
    margin: -12px 0 24px;
    background: var(--color-surface-alt, #f4f6fa);
    border-left: 3px solid var(--color-primary, #2c3e7c);
    border-radius: 4px;
    color: var(--color-text-muted, #555);
    font-size: 13px;
    line-height: 1.55;
}

.admin-help svg {
    flex-shrink: 0;
    color: var(--color-primary, #2c3e7c);
    margin-top: 2px;
}

.admin-help strong { color: var(--color-text, #222); font-weight: 600; }

.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    box-shadow: var(--shadow-sm);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.form-field > label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-field__hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.form-field__error {
    font-size: 0.78rem;
    color: #ef4444;
    font-weight: 500;
}

/* Input / select / textarea base */

.form-control,
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="number"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.92rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.form-control:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.form-field textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.form-field input[readonly] {
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* ---------- Admin data table ---------- */

.data-table-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 20px 0;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.data-table thead th {
    text-align: left;
    padding: 12px 18px;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    border-bottom: 1px solid var(--color-border);
}

.data-table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    color: var(--color-text);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: var(--color-primary-soft);
}

.data-table__id {
    color: var(--color-text-muted);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.82rem;
}

.data-table__actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.data-table__actions .btn {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.data-table input[type="text"],
.data-table input[type="number"] {
    max-width: 100px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
}

.badge--tr { background: rgba(220, 38, 38, 0.1); color: #b91c1c; }
.badge--en { background: rgba(37, 99, 235, 0.1); color: #1d4ed8; }
.badge--inactive {
    background: rgba(148, 163, 184, 0.15);
    color: #64748b;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.badge--active {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
}

.data-table tr.is-inactive td {
    opacity: 0.55;
}
.data-table tr.is-inactive td:last-child { opacity: 1; }

.cat-tree__node.is-inactive > .cat-tree__row .cat-tree__name {
    opacity: 0.55;
    text-decoration: line-through;
}

/* ---------- Tab group (language switcher on list pages) ---------- */

.tab-group {
    display: inline-flex;
    padding: 4px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    gap: 2px;
}

.tab-group a {
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.tab-group a:hover {
    color: var(--color-text);
}

.tab-group a.is-active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* ---------- Button variants ---------- */

.btn--danger {
    background: #ef4444;
    color: #fff;
}
.btn--danger:hover {
    background: #dc2626;
    color: #fff;
}

.btn--success {
    background: #10b981;
    color: #fff;
}
.btn--success:hover {
    background: #059669;
    color: #fff;
}

.btn--sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

/* ---------- Toolbar (above tables) ---------- */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar__left,
.toolbar__right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- Pager ---------- */

.pager {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 16px;
}

.pager a,
.pager span {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.pager a:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-border-strong);
}

.pager .active,
.pager .active a {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.pager .disabled,
.pager .disabled a {
    color: var(--color-text-soft);
    background: var(--color-surface);
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- Login / auth card (standalone) ---------- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: radial-gradient(ellipse at top, var(--color-primary-soft) 0%, transparent 60%),
                radial-gradient(ellipse at bottom, var(--color-accent-soft) 0%, transparent 55%),
                var(--color-bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
}

.auth-card__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
}

.auth-card__brand img {
    max-height: 56px;
}

.auth-card__title {
    text-align: center;
    margin: 0 0 6px;
    font-size: 1.4rem;
}

.auth-card__subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 0 0 28px;
}

.auth-card__error {
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #b91c1c;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    margin-bottom: 20px;
    text-align: center;
}

.auth-card .btn--primary {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

.auth-card__footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.82rem;
    color: var(--color-text-muted);
}

/* ---------- Admin category tree ---------- */

.cat-tree-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 0 12px;
    flex-wrap: wrap;
}

.cat-tree-search {
    position: relative;
    flex: 1;
    max-width: 420px;
}

.cat-tree-search input {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 40px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--color-text);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cat-tree-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.cat-tree-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-soft);
    pointer-events: none;
}

.cat-tree-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px;
    overflow: hidden;
}

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

.cat-tree ul {
    list-style: none;
    margin: 0 0 0 18px;
    padding-left: 18px;
    border-left: 1px dashed var(--color-border);
    display: none;
}

.cat-tree__node.is-expanded > ul {
    display: block;
}

.cat-tree__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.12s ease;
    min-height: 40px;
}

.cat-tree__row:hover {
    background: var(--color-surface-alt);
}

.cat-tree__toggle {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
}

.cat-tree__toggle:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.cat-tree__toggle svg {
    transition: transform 0.18s ease;
}

.cat-tree__node.is-expanded > .cat-tree__row > .cat-tree__toggle svg {
    transform: rotate(90deg);
}

.cat-tree__toggle--placeholder {
    visibility: hidden;
}

.cat-tree__name {
    flex: 1;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: text;
    min-width: 0;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-tree__name:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.cat-tree__name-input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    font: inherit;
    font-size: 0.92rem;
    outline: none;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.cat-tree__id {
    color: var(--color-text-soft);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.cat-tree__order {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
}

.cat-tree__actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.cat-tree__row:hover .cat-tree__actions,
.cat-tree__row:focus-within .cat-tree__actions {
    opacity: 1;
    pointer-events: auto;
}

.cat-tree__action {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}

.cat-tree__action:hover {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

.cat-tree__action--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

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

.cat-tree__empty {
    display: none;
    padding: 48px 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.cat-tree__empty.is-visible {
    display: block;
}

.cat-tree__node.is-hidden {
    display: none;
}

/* ---------- Tree select (category picker) ---------- */

.tree-select {
    position: relative;
    width: 100%;
}

.tree-select__trigger {
    width: 100%;
    padding: 10px 14px;
    text-align: left;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tree-select__trigger:hover {
    border-color: var(--color-primary);
}

.tree-select__trigger:focus,
.tree-select.is-open .tree-select__trigger {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
    outline: none;
}

.tree-select__selected-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-select__selected-label--placeholder {
    color: var(--color-text-soft);
}

.tree-select__trigger svg.chevron {
    transition: transform 0.18s ease;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.tree-select.is-open .tree-select__trigger svg.chevron {
    transform: rotate(180deg);
}

.tree-select__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
    max-height: 420px;
    flex-direction: column;
    overflow: hidden;
}

.tree-select.is-open .tree-select__panel {
    display: flex;
}

.tree-select__search {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
}

.tree-select__search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--color-text);
    background: var(--color-surface-alt);
    outline: none;
    box-sizing: border-box;
}

.tree-select__search input:focus {
    background: var(--color-surface);
    border-color: var(--color-primary);
}

.tree-select__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    margin: 0;
}

.tree-select__list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree-select__list > ul > li > ul,
.tree-select__node > ul {
    padding-left: 20px;
    margin-left: 12px;
    border-left: 1px dashed var(--color-border);
    display: none;
}

.tree-select__node.is-expanded > ul {
    display: block;
}

.tree-select__row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
}

.tree-select__row--parent {
    color: var(--color-text-muted);
    font-weight: 600;
}

.tree-select__row--parent:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.tree-select__row--leaf:hover,
.tree-select__row--leaf.is-focused {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.tree-select__row--leaf.is-selected {
    background: var(--color-primary);
    color: #fff;
}

.tree-select__row--leaf.is-selected:hover {
    background: var(--color-primary-hover);
}

.tree-select__toggle {
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
}

.tree-select__toggle svg {
    transition: transform 0.18s ease;
}

.tree-select__node.is-expanded > .tree-select__row > .tree-select__toggle svg {
    transform: rotate(90deg);
}

.tree-select__toggle--placeholder {
    visibility: hidden;
}

.tree-select__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-select__lang-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.tree-select__lang-badge--tr {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.tree-select__lang-badge--en {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

.tree-select__empty {
    padding: 24px 12px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.tree-select__node.is-hidden {
    display: none;
}

/* ---------- Admin content explorer (categories + contents combined) ---------- */

.content-tree-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 12px;
    margin-top: 12px;
}

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

.content-tree ul {
    list-style: none;
    margin: 0 0 0 18px;
    padding-left: 18px;
    border-left: 1px dashed var(--color-border);
    display: none;
}

.content-tree__node.is-expanded > ul {
    display: block;
}

.content-tree__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.12s ease;
    min-height: 38px;
}

.content-tree__row:hover {
    background: var(--color-surface-alt);
}

.content-tree__row--category {
    font-weight: 600;
    color: var(--color-text);
}

.content-tree__row--content {
    color: var(--color-text);
    font-size: 0.9rem;
}

.content-tree__toggle {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: inherit;
}

.content-tree__toggle:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.content-tree__toggle svg {
    transition: transform 0.18s ease;
}

.content-tree__node.is-expanded > .content-tree__row > .content-tree__toggle svg {
    transform: rotate(90deg);
}

.content-tree__toggle--placeholder {
    visibility: hidden;
}

.content-tree__icon {
    width: 18px;
    height: 18px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.content-tree__row--category .content-tree__icon {
    color: var(--color-accent);
}

.content-tree__row--content .content-tree__icon {
    color: var(--color-primary);
}

.content-tree__name {
    flex: 1;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content-tree__row--content .content-tree__name {
    cursor: text;
}

.content-tree__row--content .content-tree__name:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.content-tree__name-input {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    font: inherit;
    font-size: 0.9rem;
    outline: none;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.content-tree__count {
    color: var(--color-text-soft);
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

.content-tree__actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.content-tree__row:hover .content-tree__actions,
.content-tree__row:focus-within .content-tree__actions {
    opacity: 1;
    pointer-events: auto;
}

.content-tree__action {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text-muted);
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}

.content-tree__action:hover {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text);
}

.content-tree__action--add:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.content-tree__action--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.content-tree__node.is-inactive > .content-tree__row .content-tree__name {
    opacity: 0.55;
}

.content-tree__node.is-hidden {
    display: none;
}

.content-tree__empty {
    display: none;
    padding: 48px 20px;
    text-align: center;
    color: var(--color-text-muted);
}

.content-tree__empty.is-visible {
    display: block;
}

/* ---------- Drag handle + Sortable.js states ---------- */

.drag-handle {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-soft);
    cursor: grab;
    opacity: 0;
    flex-shrink: 0;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.cat-tree__row:hover .drag-handle,
.content-tree__row:hover .drag-handle {
    opacity: 1;
}

.drag-handle:hover { color: var(--color-primary); }

.drag-handle:active { cursor: grabbing; }

.sortable-ghost {
    opacity: 0.35;
    background: var(--color-primary-soft) !important;
}

.sortable-chosen {
    background: var(--color-surface-alt);
}

.sortable-drag {
    cursor: grabbing !important;
    opacity: 0.95;
    background: var(--color-surface) !important;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
}

/* ---------- Admin dashboard ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s ease, transform 0.2s ease;
}

.stat-card:hover {
    border-color: var(--color-border-strong);
    transform: translateY(-2px);
}

.stat-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--color-text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.stat-card__icon {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.stat-card__icon--accent { background: var(--color-accent-soft); color: var(--color-accent); }
.stat-card__icon--warning { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.stat-card__icon--success { background: rgba(16, 185, 129, 0.12); color: #047857; }

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-card__hint {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.dashboard-widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
}

.dashboard-widget__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dashboard-widget__title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.dashboard-widget__link {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

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

.dashboard-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
}

.dashboard-list li:last-child { border-bottom: none; }

.dashboard-list a {
    flex: 1;
    min-width: 0;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-list a:hover { color: var(--color-primary); }

.dashboard-list__meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---------- Bulk action bar ---------- */

.bulk-bar {
    position: sticky;
    bottom: 0;
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    margin-top: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    z-index: 20;
}

.bulk-bar.is-visible {
    display: flex;
}

.bulk-bar__count {
    font-weight: 600;
    color: var(--color-primary);
    padding-right: 12px;
    border-right: 1px solid var(--color-border);
}

.bulk-bar__spacer { flex: 1; }

.content-tree__checkbox {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin: 0 6px 0 0;
    cursor: pointer;
    accent-color: var(--color-primary);
}

/* ---------- Unsaved indicator ---------- */

.form-dirty-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
}

.form-dirty-indicator.is-visible { display: inline-flex; }

/* ---------- Tag / keyword chip input ---------- */

.tag-input {
    width: 100%;
    min-height: 44px;
    padding: 6px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    cursor: text;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tag-input:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
    outline: none;
}

.tag-input__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.tag-input__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    max-width: 100%;
}

.tag-input__chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.tag-input__chip-remove {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: inherit;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.tag-input__chip-remove:hover {
    opacity: 1;
    background: rgba(79, 70, 229, 0.15);
}

.tag-input__field {
    flex: 1;
    min-width: 140px;
    border: none;
    outline: none;
    padding: 4px 4px;
    background: transparent;
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.9rem;
}

/* ---------- Keyword chips (read-only, on article page) ---------- */

.keyword-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.keyword-chips__label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    align-self: center;
    margin-right: 4px;
}

.keyword-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

.keyword-chip:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* ---------- Related articles block ---------- */

.related-articles {
    margin-top: 36px;
    padding-top: 28px;
    border-top: 1px solid var(--color-border);
}

.related-articles__title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    font-weight: 700;
    margin: 0 0 16px;
}

.related-articles__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.related-article {
    display: block;
    padding: 14px 18px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: border-color 0.15s ease, transform 0.2s ease;
}

.related-article:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    color: var(--color-text);
}

.related-article__title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--color-text);
    line-height: 1.35;
}

.related-article__category {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

/* ---------- Article sticky subheader ---------- */

.article-subheader {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    right: 0;
    padding: 10px 32px;
    background: var(--header-bg);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 16px;
    /* Must stay BELOW .app-header (z-index:10) so the lang-menu dropdown
       inside the header can overlap the subheader correctly. */
    z-index: 9;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.22s ease, visibility 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

.article-subheader.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.article-subheader__title {
    flex: 1;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.article-subheader__meta {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

@media (max-width: 960px) {
    .article-subheader {
        left: 0;
    }
}

/* ---------- Find & Replace ---------- */

.fr-result {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 10px;
}

.fr-result__title {
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 4px;
}

.fr-result__count {
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.fr-preview-list {
    max-height: 500px;
    overflow-y: auto;
    margin-top: 16px;
    padding: 8px 0;
}

.fr-highlight {
    background: #fef3c7;
    color: #92400e;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* ---------- Content feedback widget ---------- */

.feedback-widget {
    margin-top: 40px;
    padding: 24px 28px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.feedback-widget__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 16px;
}

.feedback-widget__buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.feedback-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 999px;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.feedback-btn:hover {
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.feedback-btn--yes.is-selected {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}

.feedback-btn--no.is-selected {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.feedback-btn svg {
    width: 18px;
    height: 18px;
}

.feedback-widget__thanks {
    display: none;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 16px;
}

.feedback-widget.is-submitted .feedback-widget__thanks {
    display: block;
}

.feedback-widget__stats {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--color-text-soft);
}

.feedback-widget__comment {
    display: none;
    margin-top: 14px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.feedback-widget.is-submitted.show-comment .feedback-widget__comment {
    display: block;
}

.feedback-widget__comment textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--color-surface);
    color: var(--color-text);
    resize: vertical;
    min-height: 70px;
}

.feedback-widget__comment button {
    margin-top: 8px;
}

.feedback-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

/* ---------- Freshness badge + deprecated banner ---------- */

.freshness-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.freshness-badge.fresh-ok {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.freshness-badge.fresh-warn {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.freshness-badge.fresh-stale {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.deprecated-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    margin: 0 auto 20px;
    max-width: 1200px;
    background: #fef3c7;
    color: #78350f;
    border: 1px solid #fcd34d;
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-md);
}

[data-theme="dark"] .deprecated-banner {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.3);
    border-left-color: #f59e0b;
}

.deprecated-banner svg { flex-shrink: 0; color: #f59e0b; }

.deprecated-banner strong { display: block; margin-bottom: 2px; }

.deprecated-banner a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

.deprecated-banner a:hover { opacity: 0.8; }

/* ---------- Reduced motion (a11y) ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation: none !important;
    }
}
