@import url("fonts-tQWS_iN.css");

:root {
    --huglo-text: #131313;
    --huglo-text-muted: #808080;
    --huglo-text-placeholder: #a4a4a4;
    --huglo-accent: #6e33ff;
    --huglo-accent-soft: #eee7ff;
    --huglo-border: #dddddd;
    --huglo-bg: #ffffff;
    --huglo-sidebar-bg: #ffffff;
    --huglo-radius-sm: 6px;
    --huglo-spacing-xxxs: 8px;
    --huglo-spacing-xs: 16px;
    --huglo-spacing-sm: 24px;
    --huglo-spacing-md: 32px;
    --font-sans: "Setup Grotesk", sans-serif;
    --huglo-header-height: calc(var(--huglo-spacing-xs) * 2 + 40px + 1px);
}

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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    color: var(--huglo-text);
    background: var(--huglo-bg);
    font-family: var(--font-sans);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Public help (Huglo DS) --- */

.help-app {
    font-family: var(--font-sans);
    color: var(--huglo-text);
}

.help-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.huglo-header {
    position: relative;
    z-index: 920;
    border-bottom: 1px solid var(--huglo-border);
    background: var(--huglo-bg);
}

.huglo-header__menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: var(--huglo-radius-sm);
    background: transparent;
    color: var(--huglo-text);
    cursor: pointer;
}

.huglo-header__menu-toggle:focus-visible {
    outline: 2px solid var(--huglo-accent);
    outline-offset: 2px;
}

.huglo-header__menu-icon,
.huglo-header__menu-icon::before,
.huglo-header__menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
}

.huglo-header__menu-icon {
    position: relative;
}

.huglo-header__menu-icon::before,
.huglo-header__menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.huglo-header__menu-icon::before {
    top: -6px;
}

.huglo-header__menu-icon::after {
    top: 6px;
}

.huglo-header__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--huglo-spacing-md);
    width: 100%;
    padding: var(--huglo-spacing-xs) var(--huglo-spacing-md);
}

.huglo-header__brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.huglo-header__logo {
    display: block;
    width: auto;
    height: 32px;
}

.huglo-header__search {
    display: flex;
    justify-content: center;
    min-width: 0;
}

.huglo-header__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.huglo-search {
    display: flex;
    align-items: center;
    gap: var(--huglo-spacing-xxxs);
    width: 100%;
    max-width: 420px;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid var(--huglo-border);
    border-radius: var(--huglo-radius-sm);
    background: var(--huglo-bg);
    color: var(--huglo-text-placeholder);
    cursor: pointer;
    font: 400 14px/20px var(--font-sans);
}

.huglo-search--field {
    max-width: none;
    cursor: text;
}

.huglo-search__icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.huglo-search__icon img {
    display: block;
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.huglo-search__label {
    flex: 1;
    text-align: left;
    color: var(--huglo-text-placeholder);
}

.huglo-search__shortcut {
    flex-shrink: 0;
    font-size: 12px;
    line-height: 16px;
    color: var(--huglo-text-muted);
}

.huglo-search__input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--huglo-text);
    font: 400 14px/20px var(--font-sans);
    outline: none;
}

.huglo-search__input::placeholder {
    color: var(--huglo-text-placeholder);
}

.huglo-language {
    display: flex;
    align-items: center;
    gap: var(--huglo-spacing-sm);
}

.huglo-language__item {
    display: inline-flex;
    align-items: center;
    gap: var(--huglo-spacing-xxxs);
    padding: 0;
    font: 400 14px/22px var(--font-sans);
    color: var(--huglo-text-muted);
}

.huglo-language__item.is-active {
    color: var(--huglo-text);
}

.huglo-language__flag {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    object-fit: cover;
}

.huglo-language__code {
    font: inherit;
}

.huglo-language__chevron {
    display: block;
    width: 12px;
    height: 12px;
    object-fit: contain;
}

.help-shell__body {
    display: grid;
    grid-template-columns: 320px 1fr;
    flex: 1;
    width: 100%;
}

.help-sidebar {
    border-right: 1px solid var(--huglo-border);
    background: var(--huglo-sidebar-bg);
    padding: var(--huglo-spacing-md) var(--huglo-spacing-sm);
    overflow: auto;
}

.help-sidebar__title {
    margin: 0 0 var(--huglo-spacing-sm);
    font: 700 28px/1.2 var(--font-sans);
    letter-spacing: -0.02em;
}

.help-nav__backdrop {
    display: none;
}

.help-nav__backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(19, 19, 19, 0.35);
}

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

.huglo-menu--nested {
    margin-top: 4px;
    padding-left: var(--huglo-spacing-xs);
}

.huglo-menu-item {
    margin-bottom: 2px;
}

.huglo-menu-item__row {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 48px;
}

.huglo-menu-item__toggle,
.huglo-menu-item__spacer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.huglo-menu-item__toggle {
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.huglo-menu-item__chevron {
    display: block;
    width: 12px;
    height: 12px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.huglo-menu-item__chevron.is-expanded {
    transform: rotate(90deg);
}

.huglo-menu-item__content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.huglo-menu-item__link {
    display: block;
    padding: 8px 12px;
    border-radius: var(--huglo-radius-sm);
    font: 700 14px/22px var(--font-sans);
    color: var(--huglo-text);
}

.huglo-menu-item--on .huglo-menu-item__link {
    color: var(--huglo-text);
}

.huglo-menu-item__indicator {
    display: block;
    height: 4px;
    margin: -2px 12px 0;
    background: var(--huglo-accent);
}

.huglo-menu-item__children[hidden] {
    display: none;
}

.help-main {
    padding: 40px 56px 80px;
}

.help-article__title {
    margin: 0;
    font: 700 clamp(2rem, 4vw, 3rem)/1.15 var(--font-sans);
    letter-spacing: -0.02em;
}

.help-article__divider {
    height: 1px;
    margin: var(--huglo-spacing-sm) 0 var(--huglo-spacing-md);
    background: var(--huglo-border);
}

.help-article__content.prose {
    max-width: 760px;
    font: 400 16px/24px var(--font-sans);
    color: var(--huglo-text);
}

.help-article__content.prose h1,
.help-article__content.prose h2,
.help-article__content.prose h3 {
    font-family: var(--font-sans);
    font-weight: 700;
    color: var(--huglo-text);
    line-height: 1;
}

.help-article__content.prose img {
    max-width: 100%;
    height: auto;
    border-radius: var(--huglo-radius-sm);
}

.help-article__content.prose p {
    margin: 0 0 1rem;
}

.help-empty,
.help-empty-state p {
    color: var(--huglo-text-muted);
}

.help-home {
    max-width: 960px;
    margin: 0 auto;
}

.help-home__intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: var(--huglo-spacing-md);
}

.help-home__title {
    margin: 0 0 var(--huglo-spacing-sm);
    font: 700 clamp(2rem, 4vw, 3rem)/1.15 var(--font-sans);
    letter-spacing: -0.02em;
}

.help-home__search {
    width: 100%;
    max-width: 560px;
}

.help-home__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--huglo-spacing-sm);
}

.help-home-card {
    padding: var(--huglo-spacing-sm);
    border: 1px solid var(--huglo-border);
    border-radius: var(--huglo-radius-sm);
    background: var(--huglo-bg);
}

.help-home-card__title {
    margin: 0 0 var(--huglo-spacing-xs);
    font: 700 20px/1.3 var(--font-sans);
}

.help-home-card__title a {
    color: var(--huglo-text);
}

.help-home-card__title a:hover {
    color: var(--huglo-accent);
}

.help-home-card__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.help-home-card__list li + li {
    margin-top: 8px;
}

.help-home-card__list a {
    font: 400 14px/22px var(--font-sans);
    color: var(--huglo-text-muted);
}

.help-home-card__list a:hover {
    color: var(--huglo-accent);
}

.help-search-results__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.help-search-results__list li + li {
    margin-top: 12px;
}

.help-search-results__list a {
    color: var(--huglo-accent);
    font-weight: 600;
}

.help-search-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.help-search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(19, 19, 19, 0.35);
}

.help-search-modal__panel {
    position: relative;
    width: min(640px, calc(100% - 32px));
    margin: 15vh auto 0;
    padding: 20px;
    border-radius: var(--huglo-radius-sm);
    background: var(--huglo-bg);
    box-shadow: 0 20px 50px rgba(19, 19, 19, 0.15);
}

.help-search-modal__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin-top: 16px;
}

.help-search-modal__loading[hidden] {
    display: none;
}

.help-search-modal__spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--huglo-border);
    border-top-color: var(--huglo-accent);
    border-radius: 50%;
    animation: help-search-spin 0.7s linear infinite;
}

@keyframes help-search-spin {
    to {
        transform: rotate(360deg);
    }
}

.help-search-modal__results {
    margin-top: 16px;
    max-height: min(50vh, 360px);
    overflow: auto;
}

.help-search-modal__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.help-search-modal__list li + li {
    margin-top: 4px;
}

.help-search-modal__list a {
    display: block;
    padding: 10px 12px;
    border-radius: var(--huglo-radius-sm);
    font: 700 14px/22px var(--font-sans);
    color: var(--huglo-text);
}

.help-search-modal__list a:hover {
    background: var(--huglo-accent-soft);
}

.help-search-modal__empty {
    margin: 0;
    padding: 8px 0;
    color: var(--huglo-text-muted);
    font: 400 14px/20px var(--font-sans);
}

.help-search-modal__hint {
    margin: 12px 0 0;
    color: var(--huglo-text-muted);
    font: 400 14px/20px var(--font-sans);
}

/* --- Admin (unchanged chrome) --- */

.admin-app,
.admin-login {
    --font-sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-family: var(--font-sans);
    background: #f3f4f6;
}

.admin-shell {
    min-height: 100vh;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #111827;
    color: #fff;
}

.admin-header__brand {
    font-weight: 700;
    color: #fff;
}

.admin-header__nav {
    display: flex;
    gap: 16px;
}

.admin-header__nav a {
    color: #d1d5db;
}

.admin-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

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

.admin-toolbar h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.admin-card h2 {
    margin: 0 0 16px;
    font-size: 1.125rem;
    font-weight: 600;
}

.admin-link {
    color: #6b7280;
    font-weight: 500;
    text-decoration: none;
}

.admin-link:hover {
    color: #6e33ff;
}

.admin-form-row {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
    width: 100%;
}

.admin-form-row--checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-app form label,
.admin-login form label,
.admin-login-card form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.admin-form-row--checkbox label {
    margin: 0;
    font-weight: 500;
}

.admin-app form input[type="text"],
.admin-app form input[type="email"],
.admin-app form input[type="password"],
.admin-app form input[type="number"],
.admin-app form select,
.admin-app form textarea,
.admin-login form input[type="text"],
.admin-login form input[type="email"],
.admin-login form input[type="password"],
.admin-login form input[type="number"],
.admin-login form select,
.admin-login form textarea,
.admin-login-card input[type="text"],
.admin-login-card input[type="email"],
.admin-login-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dddddd;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    font: inherit;
    line-height: 1.4;
}

.admin-app form input[type="text"]:focus,
.admin-app form input[type="email"]:focus,
.admin-app form input[type="password"]:focus,
.admin-app form input[type="number"]:focus,
.admin-app form select:focus,
.admin-app form textarea:focus,
.admin-login form input:focus,
.admin-login-card input:focus {
    outline: 2px solid rgba(110, 51, 255, 0.25);
    border-color: #6e33ff;
}

.admin-app form input[type="checkbox"],
.admin-login form input[type="checkbox"],
.admin-login-card form input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #6e33ff;
}

.admin-app form ul,
.admin-login form ul {
    margin: 0;
    padding: 0;
    list-style: none;
    color: #991b1b;
    font-size: 0.875rem;
}

.admin-app .invalid-feedback,
.admin-login .invalid-feedback {
    color: #991b1b;
    font-size: 0.875rem;
}

.admin-login-card form input[type="hidden"] {
    display: none;
}

.admin-translations {
    margin-top: 24px;
}

.admin-tabs {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.admin-tabs__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    width: 100%;
}

.admin-tabs__panel {
    display: none;
    width: 100%;
}

.admin-tabs__panel.is-active {
    display: block;
}

.admin-editor-field,
.tiptap-editor {
    width: 100%;
}

.admin-card,
.admin-login-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(19, 19, 19, 0.06);
}

.admin-login-card {
    width: min(420px, calc(100% - 32px));
    margin: 15vh auto;
}

.admin-login-card form {
    display: grid;
    gap: 12px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.admin-table__actions {
    display: flex;
    gap: 12px;
}

.admin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    background: #6e33ff;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.admin-badge {
    display: inline-block;
    margin-right: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e5e7eb;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.admin-badge--published {
    background: #dcfce7;
    color: #166534;
}

.admin-flash {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
}

.admin-flash--success {
    background: #ecfdf5;
    color: #065f46;
}

.admin-flash--error {
    background: #fef2f2;
    color: #991b1b;
}

.admin-tabs__tab {
    padding: 8px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font: inherit;
    cursor: pointer;
}

.admin-tabs__tab.is-active {
    border-color: #6e33ff;
    color: #6e33ff;
}

.admin-editor-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.tiptap-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    background: #f9fafb;
}

.tiptap-toolbar button {
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.tiptap-toolbar button:hover {
    border-color: #c4b5fd;
    background: #faf5ff;
}

.tiptap-toolbar button.is-active {
    border-color: #6e33ff;
    color: #6e33ff;
    background: #f5f3ff;
}

.tiptap-content {
    min-height: 280px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 0 0 10px 10px;
    background: #fff;
}

.tiptap-content .ProseMirror {
    outline: none;
    min-height: 240px;
}

.tiptap-content .ProseMirror img {
    max-width: 100%;
    height: auto;
}

.admin-form-actions {
    margin-top: 24px;
}

@media (max-width: 960px) {
    .huglo-header__inner {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas: "menu brand search actions";
        gap: var(--huglo-spacing-xs);
        padding-inline: var(--huglo-spacing-xs);
    }

    .huglo-header__menu-toggle {
        display: inline-flex;
        grid-area: menu;
    }

    .huglo-header__brand {
        grid-area: brand;
    }

    .huglo-header__actions {
        grid-area: actions;
    }

    .huglo-header__search {
        grid-area: search;
        justify-content: flex-end;
    }

    .huglo-header__search .huglo-search {
        width: 40px;
        max-width: 40px;
        min-height: 40px;
        padding: 0;
        border: 0;
        justify-content: center;
        gap: 0;
    }

    .huglo-header__search .huglo-search__label,
    .huglo-header__search .huglo-search__shortcut {
        display: none;
    }

    .help-shell__body {
        display: block;
    }

    .help-nav__backdrop:not([hidden]) {
        top: var(--huglo-header-height);
    }

    .help-sidebar {
        position: fixed;
        top: var(--huglo-header-height);
        left: 0;
        bottom: 0;
        z-index: 910;
        width: min(320px, 86vw);
        max-width: 100%;
        border-right: 1px solid var(--huglo-border);
        border-bottom: 0;
        overflow: auto;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

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

    .help-main {
        padding: 24px;
    }

    .help-home__grid {
        grid-template-columns: 1fr;
    }

    .admin-grid {
        grid-template-columns: 1fr;
    }
}
