/* WikiMode - Main Stylesheet */
:root {
    --bg: #f8fafc;
    --bg-alt: #f1f5f9;
    --surface: #ffffff;
    --surface-hover: #f8fafc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #eff6ff;
    --primary-dark: #1d4ed8;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --sidebar-w: 280px;
    --header-h: 56px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', Consolas, monospace;
    --transition: 0.2s ease;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-alt: #1e293b;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --border-light: #1e293b;
    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary-light: rgba(59, 130, 246, 0.1);
    --success-bg: rgba(34, 197, 94, 0.08);
    --warning-bg: rgba(245, 158, 11, 0.08);
    --danger-bg: rgba(239, 68, 68, 0.08);
    --info-bg: rgba(6, 182, 212, 0.08);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh
}

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

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

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

::selection {
    background: var(--primary);
    color: #fff
}

/* Header */
.top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    height: var(--header-h);
    backdrop-filter: blur(12px)
}

.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 1rem;
    max-width: 100%;
    gap: 0.5rem
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-weight: 700;
    font-size: 1.1rem
}

.logo-img {
    height: 28px;
    width: auto
}

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

.nav-link {
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all var(--transition)
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 0.375rem
}

.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all var(--transition);
    border: none;
    background: none;
    cursor: pointer
}

.header-icon-btn:hover {
    background: var(--bg-alt);
    color: var(--text)
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem
}

.search-container {
    position: relative
}

.header-search-form {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    margin-top: 4px
}

.header-search-form input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem
}

/* Dropdown */
.dropdown {
    position: relative
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition)
}

.dropdown-toggle:hover {
    border-color: var(--primary);
    background: var(--primary-light)
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    padding: 0.25rem;
    margin-top: 4px
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: transparent
}

.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu {
    display: block
}

.dropdown-item {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: all var(--transition)
}

.dropdown-item:hover,
.dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary)
}

.user-btn {
    border: none;
    background: none;
    font-size: 0.8125rem
}

/* Sidebar */
.main-wrapper {
    display: flex;
    min-height: calc(100vh - var(--header-h))
}

.sidebar {
    width: var(--sidebar-w);
    border-right: 1px solid var(--border);
    background: var(--surface);
    overflow-y: auto;
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    flex-shrink: 0;
    transition: transform var(--transition)
}

.sidebar-inner {
    padding: 1rem 0
}

.sidebar-header {
    padding: 0 1rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em
}

.sidebar-empty {
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem
}

/* Tree */
.tree-list {
    list-style: none;
    padding: 0;
    margin: 0
}

.tree-item-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.75rem;
    padding-left: calc(0.75rem + var(--depth, 0) * 1rem)
}

.tree-item.has-children>.tree-list {
    display: block
}

.tree-item.has-children.collapsed>.tree-list {
    display: none
}

.tree-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
    display: flex;
    transition: transform var(--transition)
}

.tree-toggle.open svg {
    transform: rotate(90deg)
}

.tree-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    margin: 0 0.375rem;
    flex-shrink: 0
}

.tree-link {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    padding: 0.125rem 0;
    flex: 1;
    transition: color var(--transition)
}

.tree-link:hover,
.tree-link.active {
    color: var(--primary)
}

.tree-item.active>.tree-item-row {
    background: var(--primary-light);
    border-radius: var(--radius);
    margin: 0 0.5rem
}

.tree-item.active>.tree-item-row .tree-link {
    color: var(--primary);
    font-weight: 600
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem 3rem;
    max-width: 900px;
    min-width: 0
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    flex-wrap: wrap
}

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

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

.breadcrumb-sep {
    color: var(--border)
}

/* Page Content */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border)
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text)
}

.page-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted)
}

.meta-views,
.meta-edit,
.meta-export {
    display: flex;
    align-items: center;
    gap: 0.25rem
}

.meta-edit:hover,
.meta-export:hover {
    color: var(--primary)
}

.page-body {
    font-size: 0.9375rem;
    line-height: 1.8
}

.page-body h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border)
}

.page-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem
}

.page-body h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.5rem
}

.page-body p {
    margin: 0.75rem 0
}

.page-body ul,
.page-body ol {
    padding-left: 1.5rem;
    margin: 0.75rem 0
}

.page-body li {
    margin: 0.25rem 0
}

.page-body blockquote {
    border-left: 4px solid var(--primary);
    margin: 1.25rem 0;
    padding: 0.75rem 1.25rem;
    background: var(--primary-light);
    border-radius: 0 var(--radius) var(--radius) 0
}

.page-body blockquote cite {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: normal
}

/* Table of Contents */
.content-area:has(.page-with-toc) {
    max-width: 1200px
}

.page-with-toc {
    display: flex;
    gap: 3rem;
    align-items: flex-start
}

.page-body {
    flex: 1;
    min-width: 0;
    max-width: 850px
}

.page-toc-container {
    width: 240px;
    flex-shrink: 0;
    display: none
}

@media (min-width: 1100px) {
    .page-toc-container {
        display: block
    }
}

.page-toc {
    position: sticky;
    top: calc(var(--header-h) + 2rem);
    border-left: 2px solid var(--border);
    padding-left: 1rem;
    max-height: calc(100vh - var(--header-h) - 4rem);
    overflow-y: auto
}

.page-toc-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem
}

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

.page-toc-list li {
    margin-bottom: 0.625rem;
    line-height: 1.4
}

.page-toc-list a {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    transition: color var(--transition);
    display: block;
    text-decoration: none
}

.page-toc-list a:hover {
    color: var(--primary)
}

.toc-level-1,
.toc-level-2 {
    padding-left: 0;
    font-weight: 500;
    color: var(--text)
}

.toc-level-3 {
    padding-left: 1rem
}

.toc-level-4 {
    padding-left: 2rem
}

.toc-level-5 {
    padding-left: 3rem
}

.toc-level-6 {
    padding-left: 4rem
}



/* Code Blocks */
.code-block {
    margin: 1.25rem 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #232e42
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #1d1d1d;
    font-size: 0.75rem
}

.code-lang {
    color: #ffffff91;
    font-family: var(--font-mono)
}

.copy-btn {
    background: none;
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    color: #ffffff7e;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    transition: all var(--transition)
}

.copy-btn:hover {
    background: #334155;
    color: #e2e8f0
}

.code-block pre {
    margin: 0;
    padding: 1rem;
    overflow-x: auto
}

.code-block code {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: #e2e8f0;
    line-height: 1.6
}

/* Images */
.content-image {
    margin: 1.5rem 0;
    text-align: center
}

.content-image img {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 500px
}

.content-image figcaption {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-style: italic
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin: 1.25rem 0
}

.page-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem
}

.page-body th,
.page-body td {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    text-align: left
}

.page-body th {
    background: var(--bg-alt);
    font-weight: 600
}

/* Shortcodes */
.shortcode {
    margin: 1.25rem 0;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border-left: 4px solid
}

.shortcode-title {
    font-weight: 600;
    margin-bottom: 0.375rem;
    font-size: 0.875rem
}

.shortcode-note {
    border-color: var(--info);
    background: var(--info-bg)
}

.shortcode-warning {
    border-color: var(--warning);
    background: var(--warning-bg)
}

.shortcode-tip {
    border-color: var(--success);
    background: var(--success-bg)
}

.shortcode-important {
    border-color: var(--danger);
    background: var(--danger-bg)
}

.content-warning {
    margin: 1.25rem 0;
    padding: 1rem;
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--radius)
}

.content-delimiter {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 2rem 0
}

/* Page Navigation */
.page-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 3rem 0 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border)
}

.page-nav-link {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
    background: var(--surface)
}

.page-nav-link:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    background: var(--primary-light)
}

.page-nav-link.next {
    text-align: right;
    align-items: flex-end
}

.nav-direction {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600
}

.nav-title {
    font-size: 0.9375rem;
    color: var(--text);
    font-weight: 500;
    margin-top: 0.25rem
}

/* Comments */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border)
}

.comments-section h3 {
    margin-bottom: 1.25rem;
    font-size: 1.125rem
}

.comment {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    background: var(--surface)
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem
}

.comment-date {
    color: var(--text-muted)
}

.comment-body {
    font-size: 0.9375rem;
    line-height: 1.6
}

.comment-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    resize: vertical;
    margin-bottom: 0.75rem
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary)
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: var(--surface)
}

.footer-sep {
    margin: 0 0.5rem
}

/* Search Page */
.search-page {
    padding: 2rem 0
}

.search-page h1 {
    margin-bottom: 1.5rem
}

.search-form {
    margin-bottom: 2rem
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: border-color var(--transition)
}

.search-input-wrap:focus-within {
    border-color: var(--primary)
}

.search-input-wrap input {
    border: none;
    background: none;
    flex: 1;
    font-size: 1rem;
    color: var(--text);
    outline: none
}

.search-results-info {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem
}

.search-result-item {
    display: block;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    transition: all var(--transition);
    background: var(--surface)
}

.search-result-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow)
}

.search-result-item h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.25rem
}

.search-result-item p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5
}

.search-no-results {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 0
}

/* Chatbot Page */
.chatbot-page {
    height: calc(100vh - var(--header-h) - 80px)
}

.chat-container {
    display: flex;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface)
}

.chat-sidebar {
    width: 260px;
    border-right: 1px solid var(--border);
    padding: 1rem;
    overflow-y: auto;
    background: var(--bg-alt)
}

.chat-sessions {
    margin-top: 1rem
}

.chat-sessions-empty {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    padding: 1rem 0
}

.chat-session-item {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 0.25rem;
    transition: all var(--transition)
}

.chat-session-item:hover,
.chat-session-item.active {
    background: var(--primary-light);
    color: var(--primary)
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem
}

.chat-welcome {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted)
}

.chat-welcome h2 {
    margin: 1rem 0 0.5rem;
    color: var(--text)
}

.chat-message {
    margin-bottom: 1.25rem;
    display: flex;
    gap: 0.75rem
}

.chat-message.user {
    justify-content: flex-end
}

.chat-message .msg-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    line-height: 1.6
}

.chat-message.user .msg-bubble {
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px
}

.chat-message.assistant .msg-bubble {
    background: var(--bg-alt);
    color: var(--text);
    border-bottom-left-radius: 4px
}

.chat-input-form {
    padding: 1rem;
    border-top: 1px solid var(--border)
}

.chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    transition: border-color var(--transition)
}

.chat-input-wrap:focus-within {
    border-color: var(--primary)
}

.chat-input-wrap textarea {
    flex: 1;
    border: none;
    background: none;
    resize: none;
    font-family: var(--font);
    font-size: 0.9375rem;
    color: var(--text);
    outline: none;
    max-height: 120px
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0
}

.chat-send-btn:hover {
    background: var(--primary-hover)
}

/* Welcome & Error Pages */
.welcome-page,
.error-page {
    text-align: center;
    padding: 4rem 2rem
}

.welcome-icon {
    color: var(--primary);
    margin-bottom: 1rem
}

.welcome-page h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem
}

.welcome-desc {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.125rem
}

.welcome-empty {
    color: var(--text-muted);
    margin-bottom: 2rem
}

.error-page h1 {
    font-size: 4rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem
}

/* Auth Page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg)
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg)
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem
}

.auth-header h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.5
}

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

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

.btn-outline {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary)
}

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

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

.btn-danger:hover {
    background: #dc2626
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem
}

.btn-block {
    width: 100%;
    justify-content: center
}

/* Forms */
.form-group {
    margin-bottom: 1rem
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem
}

.required {
    color: var(--danger)
}

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

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1)
}

.form-input-inline {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem
}

.form-input-readonly {
    background: var(--bg-alt);
    cursor: default
}

.form-select-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-start
}

.flex-1 {
    flex: 1
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.5rem 0
}

.form-file {
    padding: 0.5rem
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border)
}

.form-actions-left {
    display: flex;
    gap: 0.75rem;
    margin-right: auto
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    transition: opacity 0.3s
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: var(--success)
}

.alert-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: var(--danger)
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-alt);
    color: var(--text-secondary)
}

.badge-success {
    background: var(--success-bg);
    color: var(--success)
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning)
}

.badge-info {
    background: var(--info-bg);
    color: var(--info)
}

/* Card */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border)
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600
}

.card-body {
    padding: 1.25rem
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle
}

.data-table td {
    height: 1px
}

.actions-cell-wrap {
    display: flex;
    gap: 0.375rem;
    align-items: center;
    min-height: 32px
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em
}

.data-table tr:hover td {
    background: var(--bg-alt)
}

.actions-cell {
    display: flex;
    gap: 0.375rem;
    align-items: center
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5)
}

.modal-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg)
}

.modal-content h3 {
    margin-bottom: 1rem
}

/* Utility */
.mt-3 {
    margin-top: 1rem
}

.mt-4 {
    margin-top: 1.5rem
}

.mb-3 {
    margin-bottom: 1rem
}

.mb-4 {
    margin-bottom: 1.5rem
}

.py-4 {
    padding-top: 2rem;
    padding-bottom: 2rem
}

.text-muted {
    color: var(--text-muted)
}

.text-center {
    text-align: center
}

.page-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem
}

/* Editor container */
.editor-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 300px;
    padding: 1rem;
    background: var(--bg)
}

/* Responsive */
@media(max-width:1024px) {
    .content-area {
        padding: 1.5rem
    }
}

@media(max-width:768px) {
    .sidebar-toggle {
        display: flex
    }

    .sidebar {
        position: fixed;
        top: var(--header-h);
        left: 0;
        z-index: 90;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg)
    }

    .sidebar.open {
        transform: translateX(0)
    }

    .content-area {
        padding: 1.25rem
    }

    .header-nav {
        display: none
    }

    .page-navigation {
        grid-template-columns: 1fr
    }

    .form-row {
        flex-direction: column
    }

    .chat-sidebar {
        display: none
    }

    .chat-container {
        border-radius: 0;
        border: none
    }
}

.current-logo-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.settings-logo-preview {
    max-height: 50px;
    width: auto;
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 4px;
    background: #fff;
}