/* ============================================================
   KnowledgeBase — crossXio Dark Theme
   Matching: crossxio.com — dark bg, white text, red #f2473f accent
   ============================================================ */

:root {
    --bg:          #f5f5f5;
    --bg-card:     #ffffff;
    --bg-alt:      #f0f0f0;
    --bg-input:    #f8f8f8;
    --border:      #e0e0e0;
    --border-soft: #ebebeb;
    --red:         #f2473f;
    --red-dark:    #d63830;
    --red-glow:    rgba(242,71,63,.15);
    --green:       #10b981;
    --amber:       #f59e0b;
    --blue:        #3b82f6;
    --purple:      #8b5cf6;
    --white:       #ffffff;
    --text:        #1a1a1a;
    --text-soft:   #444444;
    --text-muted:  #888888;
    --radius:      8px;
    --radius-lg:   12px;
    --shadow:      0 2px 16px rgba(0,0,0,.4);
    --shadow-lg:   0 8px 40px rgba(0,0,0,.6);
    --transition:  200ms cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.2;
    color: var(--text);
}

h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 2vw, 1.6rem); }
h3 { font-size: 1.1rem; }

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); text-decoration: underline; }

/* ── Navbar ── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 2.5rem;
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

/* Red top accent line */
.navbar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--red);
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .6rem;
    letter-spacing: -.02em;
}

.nav-brand:hover { text-decoration: none; color: var(--text); }

.brand-icon { color: var(--red); font-size: 1.2rem; }

.nav-brand img {
    max-height: 52px;
    max-width: 180px;
    object-fit: contain;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-link {
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-soft);
    text-decoration: none;
    padding: .3rem .5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.nav-link:hover { color: var(--text); text-decoration: none; background: var(--bg-alt); }

.nav-admin {
    background: var(--red) !important;
    color: var(--white) !important;
    padding: .35rem .9rem !important;
}

.nav-admin:hover { background: var(--red-dark) !important; }

.nav-user {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.user-avatar {
    width: 32px; height: 32px;
    background: var(--red);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .8rem;
    flex-shrink: 0;
}

.user-name { font-size: .85rem; color: var(--text-soft); }

.nav-logout {
    font-size: .78rem;
    color: var(--text-muted);
    padding: .25rem .6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: var(--transition);
    text-decoration: none;
}

.nav-logout:hover { border-color: var(--red); color: var(--red); text-decoration: none; }

/* ── Main ── */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.page-header h1 span { color: var(--red); }

/* ── Alerts ── */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: .875rem;
    font-weight: 500;
    border: 1px solid;
    animation: slideIn .3s ease;
}

@keyframes slideIn {
    from { opacity:0; transform:translateY(-6px); }
    to   { opacity:1; transform:translateY(0); }
}

.alert-success { background: rgba(16,185,129,.08); border-color: rgba(16,185,129,.25); color: #6ee7b7; }
.alert-error   { background: rgba(242,71,63,.08);  border-color: rgba(242,71,63,.25);  color: #ff9591; }
.alert-info    { background: rgba(59,130,246,.08); border-color: rgba(59,130,246,.25); color: #93c5fd; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover { border-color: #333; box-shadow: var(--shadow-lg); }

/* ── Document Grid ── */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.doc-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--cat-color, var(--red));
}

.doc-card:hover {
    border-color: #333;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.doc-category-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: .2rem .6rem;
    border-radius: 4px;
    background: color-mix(in srgb, var(--cat-color, var(--red)) 15%, transparent);
    color: var(--cat-color, var(--red));
    border: 1px solid color-mix(in srgb, var(--cat-color, var(--red)) 30%, transparent);
    width: fit-content;
}

.doc-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    line-height: 1.3;
}

.doc-title:hover { color: var(--red); text-decoration: none; }

.doc-desc {
    font-size: .85rem;
    color: var(--text-soft);
    line-height: 1.5;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.doc-meta {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.doc-actions { display: flex; gap: .5rem; margin-top: .25rem; }

/* ── Stars ── */
.stars { display: flex; gap: 2px; align-items: center; }
.star  { color: var(--border); font-size: .95rem; cursor: pointer; transition: color var(--transition); }
.star.filled { color: var(--amber); }
.stars:hover .star { color: var(--amber); }
.stars .star:hover ~ .star { color: var(--border); }
.rating-value { font-size: .78rem; color: var(--text-muted); margin-left: .25rem; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .55rem 1.15rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: .01em;
}

.btn-primary {
    background: var(--red);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--red-dark);
    color: var(--white);
    text-decoration: none;
    box-shadow: 0 0 0 3px var(--red-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-alt);
    color: var(--text-soft);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #222;
    color: var(--white);
    text-decoration: none;
    border-color: #444;
}

.btn-danger {
    background: rgba(242,71,63,.15);
    color: #ff9591;
    border: 1px solid rgba(242,71,63,.3);
}

.btn-danger:hover {
    background: var(--red);
    color: var(--white);
    text-decoration: none;
}

.btn-sm { padding: .35rem .75rem; font-size: .78rem; }

/* ── Forms ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1rem;
}

label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    padding: .7rem .9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: .9rem;
    color: var(--text);
    background: var(--bg-input);
    transition: var(--transition);
    width: 100%;
    outline: none;
}

input::placeholder, textarea::placeholder { color: var(--text-muted); }

input:focus, select:focus, textarea:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-glow);
}

select option { background: var(--bg-card); color: var(--text); }
textarea { resize: vertical; min-height: 90px; }

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

/* ── Table ── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

table { width: 100%; border-collapse: collapse; font-size: .875rem; }

th {
    background: var(--bg-alt);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    padding: .85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

td {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-soft);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-alt); }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: .18rem .6rem;
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.badge-pending  { background: rgba(245,158,11,.12); color: #fcd34d; border:1px solid rgba(245,158,11,.25); }
.badge-approved { background: rgba(16,185,129,.12); color: #6ee7b7; border:1px solid rgba(16,185,129,.25); }
.badge-rejected { background: rgba(242,71,63,.12);  color: #ff9591; border:1px solid rgba(242,71,63,.25); }
.badge-banned   { background: rgba(139,92,246,.12); color: #c4b5fd; border:1px solid rgba(139,92,246,.25); }
.badge-admin    { background: var(--red); color: var(--white); }
.badge-user     { background: var(--bg-alt); color: var(--text-soft); border:1px solid var(--border); }

/* ── Stats ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    transition: var(--transition);
}

.stat-card:hover { border-color: #333; }

.stat-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -.03em;
    line-height: 1;
    margin-top: .25rem;
}

.stat-accent { color: var(--red); }
.stat-green  { color: var(--green); }
.stat-amber  { color: var(--amber); }

/* ── Filter bar ── */
.filter-bar {
    display: flex;
    gap: .65rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar input,
.filter-bar select {
    width: auto;
    flex: 1;
    min-width: 150px;
    max-width: 240px;
}

/* ── File drop ── */
.file-drop {
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
    position: relative;
    background: var(--bg-input);
}

.file-drop:hover, .file-drop.drag-over {
    border-color: var(--red);
    background: rgba(242,71,63,.05);
    color: var(--red);
}

.file-drop input[type="file"] {
    position: absolute; inset: 0;
    opacity: 0; cursor: pointer;
    width: 100%; height: 100%;
}

.file-drop-icon { font-size: 2.5rem; margin-bottom: .5rem; display: block; }
.file-drop p { font-size: .9rem; font-weight: 500; }
.file-drop small { font-size: .8rem; }

/* ── Comments ── */
.comment-list { display: flex; flex-direction: column; gap: .75rem; }

.comment {
    background: var(--bg-alt);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .5rem;
}

.comment-avatar {
    width: 28px; height: 28px;
    background: var(--red);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.comment-author { font-weight: 600; font-size: .875rem; color: var(--white); }
.comment-date   { font-size: .75rem; color: var(--text-muted); margin-left: auto; }
.comment-body   { font-size: .875rem; color: var(--text-soft); line-height: 1.55; }

/* ── Admin layout ── */
.admin-layout {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 1.75rem;
    align-items: start;
}

.admin-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: .75rem;
    position: sticky;
    top: 76px;
}

.admin-sidebar-title {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    padding: .5rem .75rem;
    margin-bottom: .25rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .75rem;
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 500;
    color: var(--text-soft);
    text-decoration: none;
    transition: var(--transition);
}

.admin-nav-link:hover { background: var(--bg-alt); color: var(--white); text-decoration: none; }
.admin-nav-link.active { background: var(--red); color: var(--white); }

/* ── Permissions ── */
.perm-grid { display: flex; flex-direction: column; gap: .5rem; }

.perm-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1rem;
    background: var(--bg-alt);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}

.perm-label { flex: 1; font-size: .875rem; font-weight: 500; color: var(--text); }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    background: var(--border);
    border-radius: 100px;
    cursor: pointer;
    transition: var(--transition);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; top: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--red); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--white); }

/* ── Footer ── */
/* ── crossXio Footer ─────────────────────────────────────── */
.cx-footer {
    background: #0a0a0a;
    border-top: 3px solid #f2473f;
    margin-top: 4rem;
    color: #a0a0b0;
    font-size: .875rem;
}

.cx-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem 1.5rem;
}

.cx-footer-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1.4fr;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

/* Brand column */
.cx-footer-brand {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cx-footer-logos {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.cx-logo-crossxio {
    height: 36px;
    width: auto;
    object-fit: contain;
    object-position: left;
    filter: brightness(0) invert(1);
}

.cx-logo-syscomtec {
    height: 22px;
    width: auto;
    object-fit: contain;
    object-position: left;
    opacity: .7;
}

.cx-logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.03em;
}

.cx-logo-text em {
    color: #f2473f;
    font-style: normal;
}

.cx-footer-sub {
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #f2473f;
    margin: 0;
}

.cx-footer-trademark {
    font-size: .72rem;
    color: #555;
    line-height: 1.6;
    margin: 0;
}

/* Link columns */
.cx-footer-col {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.cx-footer-heading {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #fff;
    margin: 0 0 .25rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid #222;
}

.cx-footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

.cx-footer-links a {
    color: #888;
    text-decoration: none;
    font-size: .83rem;
    transition: color .2s;
}

.cx-footer-links a:hover {
    color: #f2473f;
    text-decoration: none;
}

/* Contact column */
.cx-footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    color: #888;
    font-size: .83rem;
    line-height: 1.5;
}

.cx-footer-contact svg {
    flex-shrink: 0;
    margin-top: .15rem;
    color: #f2473f;
}

.cx-footer-contact a {
    color: #888;
}

.cx-footer-contact a:hover {
    color: #f2473f;
}

/* Divider */
.cx-footer-divider {
    border: none;
    border-top: 1px solid #1e1e1e;
    margin-bottom: 1.25rem;
}

/* Bottom bar */
.cx-footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .75rem;
    color: #444;
    flex-wrap: wrap;
    gap: .5rem;
}

.cx-footer-site-link {
    color: #555;
    text-decoration: none;
    font-size: .75rem;
    transition: color .2s;
}

.cx-footer-site-link:hover {
    color: #f2473f;
}

/* Responsive */
@media (max-width: 900px) {
    .cx-footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 560px) {
    .cx-footer-grid {
        grid-template-columns: 1fr;
    }
    .cx-footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* ── Auth pages (register, forgot pw) ── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 2rem 1rem;
}

.auth-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-brand .brand-icon { font-size: 2rem; color: var(--red); display: block; margin-bottom: .4rem; }
.auth-brand h1 { font-size: 1.3rem; color: var(--white); }
.auth-brand p  { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }

.auth-box h2 { font-size: 1.3rem; margin-bottom: 1.25rem; color: var(--white); }

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    font-size: .83rem;
    color: var(--text-muted);
}

.auth-footer a { color: var(--text-soft); }
.auth-footer a:hover { color: var(--red); }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; display: block; margin-bottom: 1rem; }
.empty-state h3 { color: var(--text-soft); margin-bottom: .5rem; }

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: .35rem;
    align-items: center;
    margin-top: 1.5rem;
    justify-content: center;
}

.page-btn {
    width: 34px; height: 34px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    font-size: .85rem;
    color: var(--text-soft);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.page-btn:hover { background: var(--bg-alt); color: var(--white); text-decoration: none; }
.page-btn.active { background: var(--red); color: var(--white); border-color: var(--red); }

/* ── Highlight (search) ── */
mark {
    background: rgba(242,71,63,.25);
    color: #ff9591;
    border-radius: 3px;
    padding: 0 2px;
}

/* ── Utility ── */
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: .8rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

code {
    font-family: 'Courier New', monospace;
    font-size: .85em;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .1em .4em;
    color: var(--text-soft);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; }
    .main-content { padding: 1rem; }
    .navbar { padding: 0 1rem; }
    .user-name { display: none; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .doc-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}

.lang-switch {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .55rem;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    letter-spacing: .04em;
}

.lang-btn:hover { background: var(--bg-card); color: var(--text); text-decoration: none; }
.lang-btn.active { background: var(--red); color: var(--white); }
.lang-flag { font-size: .9rem; line-height: 1; }
.lang-flag-img { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; vertical-align: middle; display: inline-block; }

/* ══════════════════════════════════════════════════════════
   FIRMWARE PAGE
   ══════════════════════════════════════════════════════════ */
.fw-device-block { margin-bottom: 2.5rem; }

.fw-device-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1rem; padding-bottom: .75rem;
    border-bottom: 2px solid var(--border);
}
.fw-device-title {
    display: flex; align-items: center; gap: .6rem;
    font-size: 1.15rem; font-weight: 700; color: var(--white); margin: 0;
}
.fw-device-icon { font-size: 1.2rem; }
.fw-device-count { font-size: .75rem; color: var(--text-muted); font-weight: 600;
    background: var(--bg-alt); padding: .2rem .65rem; border-radius: 100px;
    border: 1px solid var(--border); }

.fw-releases { display: flex; flex-direction: column; gap: 1rem; }

.fw-release-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
    transition: border-color .2s;
}
.fw-release-card:hover { border-color: #333; }
.fw-release-card.is-latest {
    border-color: rgba(16,185,129,.35);
    box-shadow: 0 0 0 1px rgba(16,185,129,.1);
}

.fw-release-head { margin-bottom: .75rem; }
.fw-release-version-row {
    display: flex; align-items: center; gap: .6rem;
    margin-bottom: .4rem; flex-wrap: wrap;
}
.fw-version { font-size: 1.15rem; font-weight: 800; color: var(--white); letter-spacing: -.02em; }

.fw-badge {
    font-size: .68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .07em; padding: .2rem .6rem; border-radius: 100px;
}
.fw-badge-latest  { background: rgba(16,185,129,.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,.3); }
.fw-badge-stable  { background: rgba(59,130,246,.12); color: #93c5fd; border: 1px solid rgba(59,130,246,.25); }
.fw-badge-beta    { background: rgba(245,158,11,.12); color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }
.fw-badge-legacy  { background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border); }

.fw-release-meta {
    display: flex; gap: 1.25rem; font-size: .78rem;
    color: var(--text-muted); flex-wrap: wrap;
}
.fw-description {
    font-size: .875rem; color: var(--text-soft);
    line-height: 1.65; margin: .75rem 0 0;
}

.fw-changelog { margin-top: .9rem; }
.fw-changelog summary {
    font-size: .8rem; font-weight: 600; color: var(--text-muted);
    cursor: pointer; list-style: none; display: inline-flex;
    align-items: center; gap: .4rem; padding: .35rem .8rem;
    border-radius: 6px; background: var(--bg-alt);
    border: 1px solid var(--border); transition: color .15s, border-color .15s;
}
.fw-changelog summary::-webkit-details-marker { display: none; }
.fw-changelog summary:hover { color: var(--text); border-color: #444; }
.fw-changelog[open] summary { color: var(--white); border-color: #555; }
.fw-changelog-body {
    margin-top: .6rem; padding: .85rem 1rem;
    background: var(--bg-alt); border-radius: 8px;
    border: 1px solid var(--border);
    font-size: .82rem; color: var(--text-soft);
    line-height: 1.75; white-space: pre-wrap; font-family: 'Courier New', monospace;
}

.fw-files { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.fw-files-title {
    font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .1em; color: var(--text-muted); margin-bottom: .6rem;
}
.fw-files-list { display: flex; flex-direction: column; gap: .45rem; }

.fw-file-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: .65rem 1rem;
    background: var(--bg-alt); border: 1px solid var(--border);
    border-radius: 8px; transition: border-color .15s;
}
.fw-file-row:hover { border-color: #333; }
.fw-file-info { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.fw-file-icon { font-size: 1.15rem; flex-shrink: 0; }
.fw-file-label { font-size: .85rem; font-weight: 600; color: var(--white);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-file-meta { font-size: .73rem; color: var(--text-muted); margin-top: .1rem; }

.fw-admin-actions {
    display: flex; gap: .5rem; margin-top: 1rem;
    padding-top: 1rem; border-top: 1px solid var(--border);
}

@media (max-width: 640px) {
    .fw-file-row { flex-direction: column; align-items: flex-start; }
    .fw-release-card { padding: 1rem; }
}
