/* ═══════════════════════════════════════════════════════════════════
   MEMUR KAHVESİ - MODERN DESIGN SYSTEM 2026
   Premium, XenForo-inspired aesthetic
   No more blue/purple cliches!
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════
   COLOR SYSTEM - Foundation
   ═══════════════════════════════════════════════════════════════════ */

:root {
    /* Neutral Palette - Stone/Warm Grays */
    --stone-50: #fafaf9;
    --stone-100: #f5f5f4;
    --stone-200: #e7e5e4;
    --stone-300: #d6d3d1;
    --stone-400: #a8a29e;
    --stone-500: #78716c;
    --stone-600: #57534e;
    --stone-700: #44403c;
    --stone-800: #292524;
    --stone-900: #1c1917;
    
    /* Deep Navy Palette */
    --navy-600: #475569;
    --navy-700: #334155;
    --navy-800: #1e293b;
    --navy-850: #162032;
    --navy-900: #0f172a;
    --navy-950: #0a0f1a;
    
    /* Carbon Palette */
    --carbon-700: #3f3f46;
    --carbon-800: #27272a;
    --carbon-900: #18181b;
    --carbon-950: #09090b;
    
    /* Primary - Red (Existing) */
    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --red-800: #991b1b;
    --red-900: #7f1d1d;
    
    /* Success - Emerald */
    --emerald-50: #ecfdf5;
    --emerald-100: #d1fae5;
    --emerald-500: #10b981;
    --emerald-600: #059669;
    --emerald-700: #047857;
    
    /* Warning - Amber */
    --amber-50: #fffbeb;
    --amber-100: #fef3c7;
    --amber-500: #f59e0b;
    --amber-600: #d97706;
    --amber-700: #b45309;
    
    /* Global Aliases */
    --primary: var(--red-600);
    --primary-dark: var(--red-800);
    --primary-light: var(--red-100);
    
    --bg-base: var(--stone-50);
    --bg-surface: #ffffff;
    --bg-surface-raised: #ffffff;
    
    --border-light: var(--stone-200);
    --border: var(--stone-300);
    --border-strong: var(--stone-400);
    
    --text-primary: var(--stone-900);
    --text-secondary: var(--stone-600);
    --text-tertiary: var(--stone-500);
    --text-muted: var(--stone-400);
    
    /* Shadows - Refined */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    
    /* Glassmorphism Tokens */
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-bg-hover: rgba(255, 255, 255, 0.10);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-border-hover: rgba(255, 255, 255, 0.18);
    --glass-blur: blur(20px);
    --glass-highlight: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, transparent 100%);
    
    /* Radius - Xenforo Ağırbaşlılığı: Keskin ama yumuşatılmış */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-2xl: 12px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography */
    --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;

    /* Layout */
    --content-max: 1400px;
    --content-wide: 1400px;
    --content-narrow: 860px;
    --page-gutter: clamp(1rem, 3vw, 1.5rem);
    --section-gap: clamp(1.25rem, 3vw, 2rem);
    --card-padding: clamp(1rem, 2.5vw, 1.5rem);
    
    /* Letter Spacing */
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════════
   PAGE-SPECIFIC COLOR THEMES
   ═══════════════════════════════════════════════════════════════════ */

/* Homepage - Burgundy/Wine */
.theme-homepage {
    --theme-primary: #7c2d12; /* Burgundy */
    --theme-secondary: #881337; /* Wine */
    --theme-light: #fef2f2;
    --theme-gradient: linear-gradient(135deg, #7c2d12 0%, #881337 100%);
}

/* Leaderboard - Gold/Champagne */
.theme-leaderboard {
    --theme-primary: #ca8a04; /* Gold */
    --theme-secondary: #a16207;
    --theme-light: #fef3c7; /* Champagne */
    --theme-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

/* AI Asistan - Deep Purple/Electric */
.theme-ai {
    --theme-primary: #6b21a8; /* Deep Purple */
    --theme-secondary: #a855f7; /* Electric */
    --theme-light: #faf5ff;
    --theme-gradient: linear-gradient(135deg, #6b21a8 0%, #a855f7 100%);
}

/* Forum - Slate/Burgundy */
.theme-forum {
    --theme-primary: #334155; /* Slate */
    --theme-secondary: var(--red-900);
    --theme-light: #fff7f7;
    --theme-gradient: linear-gradient(135deg, #334155 0%, var(--red-900) 100%);
}

.notification-preferences-card {
    background: var(--mk-card-bg, #fff);
    border: 1px solid var(--mk-border, #e5e7eb);
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
    margin: 22px 0;
    padding: 24px;
}

.notification-preferences-head h2 {
    margin: 6px 0 6px;
    font-size: 1.35rem;
}

.notification-preferences-head p {
    margin: 0 0 18px;
    color: #64748b;
}

.notification-preferences-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.notification-preference-toggle {
    align-items: flex-start;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    min-height: 92px;
    padding: 14px;
}

.notification-preference-toggle input {
    accent-color: #991b1b;
    margin-top: 4px;
}

.notification-preference-toggle strong,
.notification-preference-toggle small {
    display: block;
}

.notification-preference-toggle small {
    color: #64748b;
    line-height: 1.45;
    margin-top: 4px;
}

.notification-preferences-actions {
    align-items: center;
    display: flex;
    grid-column: 1 / -1;
    justify-content: flex-end;
    margin-top: 4px;
}

.notifications-pref-alert {
    border-radius: 12px;
    font-weight: 800;
    margin-top: 16px;
    padding: 12px 14px;
}

.notifications-pref-alert.is-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.notifications-pref-alert.is-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.category-moderator-box {
    margin-top: 18px;
}

.category-moderator-box select[multiple] {
    min-height: 190px;
}

.category-moderator-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.category-moderator-chips span {
    align-items: center;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    color: #9a3412;
    display: inline-flex;
    font-size: .88rem;
    font-weight: 800;
    gap: 6px;
    padding: 7px 10px;
}

@media (max-width: 980px) {
    .notification-preferences-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .notification-preferences-card {
        padding: 18px;
    }

    .notification-preferences-grid {
        grid-template-columns: 1fr;
    }

    .notification-preferences-actions {
        justify-content: stretch;
    }

    .notification-preferences-actions .notifications-mark-btn {
        width: 100%;
    }
}

/* Documents - Amber/Honey */
.theme-documents {
    --theme-primary: #d97706; /* Amber */
    --theme-secondary: #f59e0b; /* Honey */
    --theme-light: #fffbeb;
    --theme-gradient: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
}

/* Profile - Red (Dynamic per role) */
.theme-profile {
    --theme-primary: var(--red-600);
    --theme-secondary: var(--red-700);
    --theme-light: var(--red-50);
    --theme-gradient: linear-gradient(135deg, var(--red-600) 0%, var(--red-700) 100%);
}

/* ═══════════════════════════════════════════════════════════════════
   GLOBAL RESETS & BASE STYLES
   ═══════════════════════════════════════════════════════════════════ */

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    overflow-x: hidden;
}

img,
video,
canvas,
svg,
iframe {
    max-width: 100%;
}

img,
video {
    height: auto;
}

table {
    max-width: 100%;
}

input,
select,
textarea,
button {
    font: inherit;
    max-width: 100%;
}

.skip-link {
    position: fixed;
    left: 1rem;
    top: 1rem;
    z-index: 10000;
    transform: translateY(-160%);
    padding: .75rem 1rem;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-ink, #18181b);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--mk-shadow, 0 14px 30px rgba(24, 24, 27, .18));
    transition: transform .18s ease;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 3px solid color-mix(in srgb, var(--mk-brand, #7f1d1d) 38%, white);
    outline-offset: 2px;
}

.site-main {
    min-height: calc(100vh - 220px);
    padding-block: var(--section-gap);
}

.site-main:focus {
    outline: none;
}

.site-footer {
    margin-top: var(--section-gap);
    padding: 1.5rem var(--page-gutter);
    border-top: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface, #fff);
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.site-footer p {
    margin: 0;
    font-size: .92rem;
}

/* Shared page rails for old and newly added modules */
.container,
.page-container,
.app-container,
.content-container,
.main-container,
.admin-container,
.mod-container,
.modcp-container,
.blog-section-wrap,
.bh-container,
.becayis-wrap,
.becayis-form-wrap,
.becayis-detay-wrap,
.becayis-profil-wrap {
    width: min(100% - (var(--page-gutter) * 2), var(--content-max));
    margin-left: auto;
    margin-right: auto;
}

.page-container-narrow {
    width: min(100% - (var(--page-gutter) * 2), var(--content-narrow));
    margin-left: auto;
    margin-right: auto;
}

.page-container-wide {
    width: min(100% - (var(--page-gutter) * 2), var(--content-wide));
    margin-left: auto;
    margin-right: auto;
}

.page-section {
    margin-top: var(--section-gap);
    margin-bottom: var(--section-gap);
}

/* Unified content rails
   Forum and document archive already use 1400px. Newer information-center
   pages had mixed widths, so this keeps the site's visual width consistent. */
.tools-page,
.law-page-container,
.law-page,
.law-detail-page,
.article-page,
.search-page-container,
.city-page,
.city-detail-page,
.compare-page,
.search-page,
.document-view-page,
.document-page-container,
.studio-page,
.docs-page,
.verify-page,
.prepare-page,
.view-page,
.ban-container,
.homepage-container,
.topic-page,
.leaderboard-page,
.cetele-page-container,
.cetele-container,
.signals-page-container,
.documents-page-container,
.messages-container,
.chat-page-modern,
.classic-forum-wrapper,
.new-topic-page,
.new-signal-page,
.upload-document-page {
    width: min(100% - (var(--page-gutter) * 2), var(--content-wide)) !important;
    max-width: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.tools-page,
.law-page-container,
.law-page,
.law-detail-page,
.article-page,
.search-page-container,
.city-page,
.city-detail-page,
.compare-page,
.search-page {
    padding-top: var(--section-gap) !important;
    padding-bottom: var(--section-gap) !important;
}

/* Ana sayfa wrapper'ları — yatay padding'i sıfırla, genişlik context'e bırak */
.mk-legal-search,
.mk-aym-search,
.mk-announcements {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* İç kart'lar — 1400px genişlik + ortalama */
.mk-search-hero,
.mk-results-panel,
.mk-aym-card,
.mk-aym-results,
.mk-official-card,
.mk-gateway-card,
.mk-simple-hero,
.mk-source-tabs,
.mk-search-panel,
.mk-link-list {
    width: min(100% - (var(--page-gutter) * 2), var(--content-wide)) !important;
    max-width: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.content-card,
.panel-card,
.form-card,
.admin-card,
.dashboard-card {
    max-width: 100%;
}

.table-wrap,
.table-responsive,
.admin-table-wrap,
.responsive-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap > table,
.table-responsive > table,
.admin-table-wrap > table,
.responsive-table > table {
    min-width: 720px;
}

.similar-suggestions {
    margin-top: 0.85rem;
    padding: 1rem;
    border: 1px solid var(--amber-100);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
    box-shadow: var(--shadow-sm);
}

.similar-suggestions[hidden] {
    display: none !important;
}

.similar-suggestions-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.similar-suggestions-head strong {
    color: var(--amber-700);
    font-size: 0.95rem;
}

.similar-suggestions-head span,
.similar-suggestions-loading {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.similar-suggestions-list {
    display: grid;
    gap: 0.65rem;
}

.similar-suggestion-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: #ffffff;
    color: inherit;
    text-decoration: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.similar-suggestion-item:hover {
    border-color: var(--amber-500);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.similar-suggestion-body {
    min-width: 0;
}

.similar-suggestion-body strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.94rem;
    line-height: 1.35;
}

.similar-suggestion-body p {
    margin: 0.25rem 0 0;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.45;
}

.similar-suggestion-meta {
    align-self: flex-start;
    flex-shrink: 0;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-full);
    background: var(--stone-100);
    color: var(--stone-600);
    font-size: 0.75rem;
    font-weight: 700;
}

.page-header,
.admin-page-head,
.section-header,
.toolbar,
.filter-bar,
.action-bar {
    min-width: 0;
}

.grid,
.stats-grid,
.stat-grid,
.dashboard-grid,
.settings-grid,
.featured-grid,
.cards-grid {
    min-width: 0;
}

.grid > *,
.stats-grid > *,
.stat-grid > *,
.dashboard-grid > *,
.settings-grid > *,
.featured-grid > *,
.cards-grid > * {
    min-width: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   TYPOGRAPHY SYSTEM
   ═══════════════════════════════════════════════════════════════════ */

.text-display {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: var(--tracking-tight);
    line-height: 1.1;
}

.text-h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: var(--tracking-tight);
    line-height: 1.2;
}

.text-h2 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: var(--tracking-tight);
    line-height: 1.3;
}

.text-h3 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.4;
}

.text-h4 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.4;
}

.text-body-lg {
    font-size: 1.125rem;
    line-height: 1.75;
}

.text-body {
    font-size: 1rem;
    line-height: 1.6;
}

.text-body-sm {
    font-size: 0.875rem;
    line-height: 1.5;
}

.text-caption {
    font-size: 0.75rem;
    line-height: 1.4;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════
   MODERN CARD SYSTEM
   ═══════════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-flat {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: none;
}

.card-raised {
    background: var(--bg-surface-raised);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.card-interactive {
    cursor: pointer;
    transition: all var(--transition-base);
}

.card-interactive:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
    border-color: var(--border-strong);
}

/* ═══════════════════════════════════════════════════════════════════
   BUTTON SYSTEM
   ═══════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--stone-800);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--stone-900);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border-color: var(--border);
}

.btn-outline:hover {
    background: var(--stone-100);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--stone-100);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ═══════════════════════════════════════════════════════════════════
   BADGE SYSTEM
   ═══════════════════════════════════════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: var(--red-100);
    color: var(--red-700);
}

.badge-success {
    background: var(--emerald-100);
    color: var(--emerald-700);
}

.badge-warning {
    background: var(--amber-100);
    color: var(--amber-700);
}

.badge-neutral {
    background: var(--stone-200);
    color: var(--stone-700);
}

.badge-outline {
    background: transparent;
    border: 1px solid currentColor;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════════ */

.input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

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

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.textarea {
    min-height: 120px;
    resize: vertical;
}

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* ═══════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════ */

/* Spacing */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }

/* Flex */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.4s ease;
}

.animate-slide-up {
    animation: slideUp 0.5s ease;
}

.animate-slide-in {
    animation: slideIn 0.4s ease;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE UTILITIES
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .text-display { font-size: 2rem; }
    .text-h1 { font-size: 1.875rem; }
    .text-h2 { font-size: 1.5rem; }

    .container,
    .page-container,
    .app-container,
    .content-container,
    .main-container,
    .admin-container,
    .mod-container,
    .modcp-container,
    .blog-section-wrap,
    .bh-container,
    .page-container-narrow,
    .page-container-wide {
        width: min(100% - 1.5rem, var(--content-max));
    }

    .page-header,
    .admin-page-head,
    .section-header,
    .toolbar,
    .filter-bar,
    .action-bar {
        align-items: stretch;
    }

    .page-header > *,
    .admin-page-head > *,
    .section-header > *,
    .toolbar > *,
    .filter-bar > *,
    .action-bar > * {
        min-width: 0;
    }

    .similar-suggestions-head,
    .similar-suggestion-item {
        flex-direction: column;
    }

    .similar-suggestion-meta {
        max-width: 100%;
    }
    
    .md\:hidden { display: none; }
}

@media (min-width: 769px) {
    .md\:block { display: block; }
    .md\:flex { display: flex; }
}

/* Gamification rank badge */
.user-rank-badge-mini {
    --rank-color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.28rem;
    min-width: 1.45rem;
    height: 1.45rem;
    padding: 0 0.42rem;
    border: 1px solid #e2e8f0;
    border-color: color-mix(in srgb, var(--rank-color) 45%, transparent);
    border-radius: 999px;
    background: #fff;
    background:
        radial-gradient(circle at 35% 20%, rgba(255, 255, 255, .82), transparent 34%),
        color-mix(in srgb, var(--rank-color) 14%, white);
    color: var(--rank-color);
    box-shadow: 0 4px 12px rgba(15, 23, 42, .08);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--rank-color) 18%, transparent);
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
    vertical-align: middle;
}

.rank-yeni-memur { --rank-color: #9ca3af; }
.rank-yardimsever { --rank-color: #92400e; }
.rank-tecrubeli { --rank-color: #3b82f6; }
.rank-saygin { --rank-color: #8b5cf6; }
.rank-kidemli { --rank-color: #f59e0b; }
.rank-mentor { --rank-color: #c026d3; }
.role-admin { --rank-color: #dc2626; }
.role-mod { --rank-color: #10b981; }

.user-rank-badge-mini.rank-yeni-memur,
.document-view-page .uploader-badge.rank-yeni-memur {
    --rank-color: #9ca3af;
}

.user-rank-badge-mini.rank-yardimsever,
.document-view-page .uploader-badge.rank-yardimsever {
    --rank-color: #92400e;
}

.user-rank-badge-mini.rank-tecrubeli,
.document-view-page .uploader-badge.rank-tecrubeli {
    --rank-color: #3b82f6;
}

.user-rank-badge-mini.rank-saygin,
.document-view-page .uploader-badge.rank-saygin {
    --rank-color: #8b5cf6;
}

.user-rank-badge-mini.rank-kidemli,
.document-view-page .uploader-badge.rank-kidemli {
    --rank-color: #f59e0b;
}

.user-rank-badge-mini.rank-mentor,
.document-view-page .uploader-badge.rank-mentor {
    --rank-color: #c026d3;
}

.user-rank-badge-mini.role-admin,
.document-view-page .uploader-badge.role-admin {
    --rank-color: #dc2626;
}

.user-rank-badge-mini.role-mod,
.document-view-page .uploader-badge.role-mod {
    --rank-color: #10b981;
}

.user-rank-badge-mini.rank-special-package {
    --rank-color: var(--special-badge-border, #991b1b);
    color: var(--special-badge-color, #fff);
    background: var(--special-badge-bg, #7f1d1d);
    border-color: var(--special-badge-border, #991b1b);
    box-shadow: 0 8px 20px rgba(24, 24, 27, .16);
}

.user-rank-badge-mini.rank-special-package .user-rank-badge-label {
    color: var(--special-badge-color, #fff);
}

.document-view-page .uploader-badge.rank-special-package {
    --rank-color: var(--special-badge-border, #991b1b);
    color: var(--special-badge-color, #fff);
    background: var(--special-badge-bg, #7f1d1d);
    border-color: var(--special-badge-border, #991b1b);
}

.user-rank-badge-mini.role-admin {
    animation: rankGlowRed 2.4s ease-in-out infinite;
}

.user-rank-badge-mini.role-mod {
    animation: rankGlowGreen 2.4s ease-in-out infinite;
}

.user-colored-name {
    color: var(--rank-color, var(--mk-brand, #7f1d1d));
}

.user-colored-name.is-bold {
    font-weight: 600;
}

.user-colored-name.rank-yeni-memur { --rank-color: #9ca3af; }
.user-colored-name.rank-yardimsever { --rank-color: #92400e; }
.user-colored-name.rank-tecrubeli { --rank-color: #3b82f6; }
.user-colored-name.rank-saygin { --rank-color: #8b5cf6; }
.user-colored-name.rank-kidemli { --rank-color: #f59e0b; }
.user-colored-name.rank-mentor { --rank-color: #c026d3; }
.user-colored-name.role-admin { --rank-color: #dc2626; }
.user-colored-name.role-mod { --rank-color: #10b981; }
.user-colored-name.rank-special-package { color: var(--rank-color, #7f1d1d); }

.user-badge.rank-special-package {
    --rank-color: var(--special-badge-border, #991b1b);
    color: var(--special-badge-color, #fff);
    background: var(--special-badge-bg, #7f1d1d);
    border-color: var(--special-badge-border, #991b1b);
}

.user-badge.rank-special-package .badge-title,
.user-badge.rank-special-package .badge-icon {
    color: var(--special-badge-color, #fff);
}

.avatar-placeholder.rank-special-package,
.user-avatar.avatar-placeholder.rank-special-package {
    background: var(--rank-color, #7f1d1d);
    color: #fff;
}

.user-rank-badge-mini .user-rank-badge-label {
    font-size: 0.72rem;
    letter-spacing: .01em;
    white-space: nowrap;
}

.verified-institution-badge {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    min-height: 24px;
    padding: .18rem .46rem;
    border: 1px solid #86efac;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-size: .74rem;
    font-weight: 950;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;
}

.verified-institution-icon {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #16a34a;
    color: #fff;
    font-size: .68rem;
    font-weight: 950;
}

.verified-institution-label {
    letter-spacing: .01em;
}

.gamification-confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2147483000;
}

.profile-avatar {
    position: relative;
}

.profile-avatar-rank {
    position: absolute;
    right: -0.35rem;
    bottom: 0.35rem;
    z-index: 2;
}

.mk-rank-popup {
    border-radius: 20px !important;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28) !important;
}

.gamification-fallback-panel {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2147483001;
    max-width: 360px;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    background: #0f172a;
    color: #fff;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .28);
    font-family: Arial, sans-serif;
}

.gamification-fallback-title {
    display: block;
    margin-bottom: .35rem;
}

.rank-popup-message {
    margin: 0;
    color: #475569;
}

.rank-popup-rank {
    color: var(--rank-popup-color, #16a34a);
}

.rank-popup-bonus {
    margin: .45rem 0 0;
    color: #64748b;
}

@keyframes rankGlowRed {
    0%, 100% { box-shadow: 0 4px 12px rgba(220, 38, 38, .18); }
    50% { box-shadow: 0 6px 20px rgba(220, 38, 38, .38); }
}

@keyframes rankGlowGreen {
    0%, 100% { box-shadow: 0 4px 12px rgba(16, 185, 129, .18); }
    50% { box-shadow: 0 6px 20px rgba(16, 185, 129, .38); }
}

/* ═══════════════════════════════════════════════════════════════════
   UNIFIED PAGE HERO ANIMATIONS
   Auto-applied to all page hero/header sections for consistent
   fade-in-up entrance effect across the entire platform.
   ═══════════════════════════════════════════════════════════════════ */

@keyframes pageFadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Hero Headers - dark/gradient top sections */
.forum-topbar,
.documents-hero,
.mk-simple-hero,
.tools-hero,
.law-hero,
.city-hero,
.compare-hero,
.becayis-hero {
    animation: pageFadeInUp 0.6s ease-out;
}

/* Content cards/panels that appear below the hero */
.forum-stats-bar,
.forum-search-panel,
.welcome-strip,
.category-section,
.documents-search-panel,
.popular-banner,
.mk-source-tabs,
.mk-search-panel,
.mk-link-list,
.tools-content,
.tools-grid,
.quick-strip,
.tools-dashboard,
.insight-grid,
.tools-roadmap,
.law-search,
.law-grid,
.city-grid,
.compare-controls,
.compare-results,
.becayis-content,
.categories-wrapper {
    animation: pageFadeInUp 0.5s ease-out both;
}

/* Staggered delay for secondary sections */
.forum-stats-bar,
.documents-search-panel,
.quick-strip,
.mk-source-tabs { animation-delay: 0.08s; }

.forum-search-panel,
.popular-banner,
.tools-dashboard,
.mk-search-panel { animation-delay: 0.14s; }

.welcome-strip,
.insight-grid,
.mk-link-list { animation-delay: 0.18s; }

.category-section,
.tools-roadmap,
.categories-wrapper { animation-delay: 0.22s; }

/* ═══════════════════════════════════════════════════════════════════
   UNIFIED PAGE HERO TITLE SIZES
   All header (H1) text sizes are unified to match the document archive page.
   header size (2.25rem, font-weight 900) across the entire platform.
   ═══════════════════════════════════════════════════════════════════ */
.documents-hero h1,
.documents-hero .hero-title,
.search-hero h1,
.law-hero h1,
.mk-simple-hero h1,
.city-hero h1,
.compare-hero h1,
.tools-hero h1,
.studio-hero h1,
.docs-hero h1,
.blog-hero h1,
.becayis-hero h1,
.forum-title {
    font-size: 2.25rem !important;
    font-weight: 900 !important;
    letter-spacing: -0.02em !important;
}

/* Memur Kahvesi design refresh - phase 1 */
:root {
    --mk-bg: #f6f5f2;
    --mk-bg-soft: #fbfaf8;
    --mk-surface: #ffffff;
    --mk-surface-muted: #f8fafc;
    --mk-ink: #18181b;
    --mk-ink-soft: #334155;
    --mk-muted: #64748b;
    --mk-line: #e4dfd7;
    --mk-line-strong: #d6cec2;
    --mk-brand: #7f1d1d;
    --mk-brand-strong: #5f1515;
    --mk-accent: #166534;
    --mk-accent-strong: #14532d;
    --mk-navy: #111827;
    --mk-radius: 8px;
    --mk-radius-lg: 10px;
    --mk-shadow: 0 10px 26px rgba(24, 24, 27, .07);
    --mk-shadow-lg: 0 22px 55px rgba(17, 24, 39, .15);
}

html {
    background: var(--mk-bg) !important;
}

body {
    background:
        linear-gradient(180deg, #fafafa 0%, var(--mk-bg) 410px, #f7f7f5 100%) !important;
    color: var(--mk-ink) !important;
}

.classic-forum-wrapper,
.documents-page-container,
.tools-page,
.law-page-container,
.law-page,
.law-detail-page,
.article-page,
.search-page-container,
.city-page,
.city-detail-page,
.compare-page,
.search-page,
.mk-announcements,
.mk-legal-search,
.mk-aym-search,
.mk-official-detail,
.mk-legal-gateway {
    background: transparent !important;
}

.documents-hero,
.tools-hero,
.law-hero,
.law-detail-hero,
.article-hero,
.city-hero,
.city-detail-hero,
.compare-hero,
.search-hero,
.mk-simple-hero,
.mk-search-hero,
.mk-aym-card {
    background:
        linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%) !important;
    border: 1px solid rgba(255,255,255,.09) !important;
    border-radius: var(--mk-radius-lg) !important;
    box-shadow: var(--mk-shadow-lg) !important;
    color: #fff !important;
}

.documents-hero h1,
.tools-hero h1,
.law-hero h1,
.law-detail-hero h1,
.article-hero h1,
.city-hero h1,
.city-detail-hero h1,
.compare-hero h1,
.search-hero h1,
.mk-simple-hero h1,
.mk-search-hero h1,
.mk-aym-card h1 {
    color: #fff !important;
    font-size: clamp(2rem, 3.2vw, 2.7rem) !important;
    line-height: 1.08 !important;
    letter-spacing: 0 !important;
}

.documents-hero p,
.tools-hero p,
.law-hero p,
.law-detail-hero p,
.article-hero p,
.city-hero p,
.city-detail-hero p,
.compare-hero p,
.search-hero p,
.mk-simple-hero p,
.mk-search-hero .mk-lead,
.mk-aym-card .mk-lead {
    color: rgba(255,255,255,.76) !important;
}

.law-eyebrow,
.mk-kicker,
.tools-kicker,
.city-back,
.compare-back,
.law-back,
.article-back,
.search-back,
.mk-back-link {
    letter-spacing: 0 !important;
}

.documents-search-panel,
.popular-banner,
.forum-topbar,
.forum-stats-bar,
.forum-search-panel,
.category-section,
.quick-card,
.tool-card,
.side-card,
.insight-card,
.law-filter,
.law-section,
.law-document-card,
.law-search-card,
.law-warning,
.law-panel,
.law-card,
.law-topic-card,
.law-result-row,
.law-source-panel,
.article-row,
.article-summary,
.article-paper,
.article-source-panel,
.city-warning,
.city-card,
.city-empty,
.city-source-strip > div,
.city-note-card,
.district-card,
.district-empty,
.city-pros-cons article,
.experience-card,
.experience-form,
.city-verified-panel,
.verified-group-card,
.compare-warning,
.compare-form,
.compare-empty,
.compare-table-wrap,
.compare-notes article,
.compare-districts,
.search-alert,
.search-summary,
.search-live-links,
.search-empty,
.search-starters,
.result-group,
.mk-source-tabs,
.mk-search-panel,
.mk-link-list,
.mk-official-card,
.mk-gateway-card,
.mk-results-panel,
.mk-aym-results,
.document-detail,
.document-view-page .forum-breadcrumb {
    background: var(--mk-surface) !important;
    border: 1px solid var(--mk-line) !important;
    border-radius: var(--mk-radius-lg) !important;
    box-shadow: var(--mk-shadow) !important;
}

.tool-card,
.quick-card,
.law-card,
.law-topic-card,
.city-card,
.result-card,
.mk-update-card,
.mk-source-tab,
.mk-result-card,
.mk-aym-result-card,
.document-card,
.forum-topic-row {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important;
}

.tool-card:hover,
.quick-card:hover,
.law-card:hover,
.law-topic-card:hover,
.city-card:hover,
.result-card:hover,
.mk-update-card:hover,
.mk-source-tab:hover,
.mk-result-card:hover,
.mk-aym-result-card:hover,
.document-card:hover,
.forum-topic-row:hover {
    border-color: var(--mk-line-strong) !important;
    box-shadow: 0 16px 34px rgba(24, 24, 27, .10) !important;
    transform: translateY(-2px) !important;
}

a.hero-primary,
a.hero-secondary,
a.tools-action,
.city-compare-link,
.city-card-foot a,
.compare-hero-layout > a,
.compare-form button,
.compare-empty a,
.law-filter button,
.law-topic-card a,
.law-result-row a,
.law-card-foot a,
.law-empty a,
.law-detail-layout > a,
.article-row-actions a,
.empty-box a,
.article-filter button,
.law-source-actions a,
.article-hero-layout > a,
.article-source-actions a,
.article-stub-actions a,
.search-form button,
.search-live-links a,
.search-starters a,
.save-form button,
.mk-official-search button,
.mk-aym-form button,
.mk-back-actions a,
.mk-official-card a,
.mk-gateway-card a,
.document-actions .btn,
.city-message a,
.law-message a,
.article-message a {
    border-radius: var(--mk-radius) !important;
    box-shadow: none !important;
    font-weight: 850 !important;
    letter-spacing: 0 !important;
}

a.hero-primary,
.city-compare-link,
.city-card-foot a,
.compare-hero-layout > a,
.compare-form button,
.compare-empty a,
.law-filter button,
.law-topic-card a,
.law-result-row a,
.law-card-foot a,
.law-empty a,
.law-detail-layout > a,
.article-row-actions a,
.empty-box a,
.article-filter button,
.law-source-actions a,
.article-hero-layout > a,
.article-source-actions a,
.article-stub-actions a,
.search-form button,
.save-form button,
.mk-official-search button,
.mk-aym-form button,
.document-actions .btn-download {
    background: var(--mk-brand) !important;
    border-color: var(--mk-brand) !important;
    color: #fff !important;
}

a.hero-primary:hover,
.city-compare-link:hover,
.city-card-foot a:hover,
.compare-form button:hover,
.law-filter button:hover,
.search-form button:hover,
.mk-official-search button:hover,
.mk-aym-form button:hover,
.document-actions .btn-download:hover {
    background: var(--mk-brand-strong) !important;
}

a.hero-secondary,
.law-source-actions a:last-child,
.article-source-actions a:last-child,
.article-stub-actions a:last-child,
.mk-back-actions a.secondary {
    background: var(--mk-navy) !important;
    color: #fff !important;
}

input,
select,
textarea,
.search-form input,
.search-form select,
.law-filter input,
.law-filter select,
.article-filter input,
.city-filter input,
.city-filter select,
.compare-form select,
.mk-official-search input,
.mk-aym-form input,
.mk-aym-form select,
.experience-form input,
.experience-form select,
.experience-form textarea {
    border-color: var(--mk-line-strong) !important;
    border-radius: var(--mk-radius) !important;
    color: var(--mk-ink) !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--mk-brand) !important;
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12) !important;
    outline: none !important;
}

.tier-badge,
.tool-status,
.law-topic-meta span,
.law-card-top span,
.result-group-head span,
.city-mini-meta span,
.district-tags span,
.mk-simple-stats div,
.mk-update-meta span {
    border-radius: 999px !important;
}

@media (max-width: 760px) {
    .documents-hero,
    .tools-hero,
    .law-hero,
    .law-detail-hero,
    .article-hero,
    .city-hero,
    .city-detail-hero,
    .compare-hero,
    .search-hero,
    .mk-simple-hero,
    .mk-search-hero,
    .mk-aym-card {
        padding: 1.25rem !important;
    }
}

/* Phase 1 refinements for the newer information-center screens */
.mk-cities-main,
.mk-compare-main {
    background: transparent !important;
}

.mk-hero-header {
    background:
        linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%) !important;
    border: 1px solid rgba(255,255,255,.09) !important;
    border-radius: var(--mk-radius-lg) !important;
    box-shadow: var(--mk-shadow-lg) !important;
}

.mk-hero-title {
    color: #fff !important;
    font-size: clamp(2rem, 3.2vw, 2.7rem) !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
}

.mk-hero-subtitle {
    color: rgba(255,255,255,.76) !important;
}

.mk-hero-back,
.mk-hero-official-btn {
    border-radius: var(--mk-radius) !important;
}

.mk-hero-official-btn {
    background: rgba(255,255,255,.10) !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    box-shadow: none !important;
}

.mk-hero-bg-wave,
.hero-bg-pattern {
    display: none !important;
}

.mk-search-hero,
.mk-aym-card {
    background: var(--mk-surface) !important;
    border: 1px solid var(--mk-line) !important;
    border-radius: var(--mk-radius-lg) !important;
    box-shadow: var(--mk-shadow) !important;
    color: var(--mk-ink) !important;
}

.mk-search-hero h1,
.mk-aym-card h1 {
    color: var(--mk-ink) !important;
}

.mk-search-hero .mk-lead,
.mk-aym-card .mk-lead {
    color: var(--mk-muted) !important;
}

.mk-official-search,
.mk-aym-form,
.mk-example-list,
.mk-official-box,
.mk-document-panel,
.mk-result-row,
.mk-announcement-row,
.mk-empty-state,
.mk-warning-box,
.mk-meta-grid div,
.mk-notice {
    background: var(--mk-surface-muted) !important;
    border: 1px solid var(--mk-line) !important;
    border-radius: var(--mk-radius) !important;
}

.mk-result-row.is-selected,
.mk-tab.is-active {
    background: #fff7f7 !important;
    border-color: rgba(127, 29, 29, .34) !important;
}

.mk-result-row:hover,
.mk-announcement-row:hover,
.mk-tab:hover {
    border-color: var(--mk-line-strong) !important;
    box-shadow: 0 12px 28px rgba(24, 24, 27, .08) !important;
}

.mk-form-actions button,
.mk-form-actions a,
.mk-official-box a,
.mk-results-head a,
.mk-pagination a,
.mk-primary-link,
.mk-secondary-link,
.mk-result-actions a,
.mk-document-tools a,
.mk-document-tools button,
.mk-search-form button,
.mk-ghost-button,
.mk-row-action a,
.mk-hero-official-btn {
    border-radius: var(--mk-radius) !important;
    font-weight: 850 !important;
    letter-spacing: 0 !important;
}

.mk-form-actions button,
.mk-official-box a,
.mk-results-head a,
.mk-primary-link,
.mk-result-actions a,
.mk-search-form button,
.mk-row-action a {
    background: var(--mk-brand) !important;
    border-color: var(--mk-brand) !important;
    color: #fff !important;
}

.mk-secondary-link,
.mk-ghost-button,
.mk-pagination a,
.mk-document-tools a,
.mk-document-tools button {
    background: #fff !important;
    border: 1px solid var(--mk-line-strong) !important;
    color: var(--mk-ink-soft) !important;
}

.mk-row-title,
.mk-result-row h3,
.mk-document-head h3,
.mk-list-head h2,
.mk-results-head h2 {
    color: var(--mk-ink) !important;
}

.mk-row-meta,
.mk-result-row p,
.mk-document-head p,
.mk-document-source,
.mk-list-head p,
.mk-results-head p {
    color: var(--mk-muted) !important;
}

.mk-tab {
    background: var(--mk-surface) !important;
    border: 1px solid var(--mk-line) !important;
    border-radius: var(--mk-radius) !important;
    color: var(--mk-ink) !important;
}

/* Phase 2: shared page rhythm for information-center modules */
.tools-page,
.law-page-container,
.search-page-container,
.announcements-page-container,
.emsal-page-container,
.aym-page-container,
.city-page,
.compare-page {
    width: min(100% - (var(--page-gutter) * 2), var(--content-wide)) !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: clamp(1rem, 2.5vw, 2rem) 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
}

.mk-legal-search,
.mk-aym-search,
.mk-announcements {
    background: transparent !important;
    min-height: auto !important;
    padding: 0 !important;
}

.tools-hero,
.law-hero,
.search-hero,
.announcements-hero,
.city-hero,
.city-detail-hero,
.compare-hero,
.mk-hero-header,
.article-hero {
    padding: clamp(1.35rem, 3vw, 2.25rem) !important;
    margin: 0 !important;
    min-height: auto !important;
}

.hero-content,
.mk-hero-content,
.city-detail-layout,
.compare-hero-layout,
.law-detail-layout,
.article-hero-layout {
    gap: clamp(1rem, 3vw, 2rem) !important;
}

.hero-left,
.mk-hero-left {
    min-width: 0 !important;
}

.hero-title,
.mk-hero-title,
.law-detail-hero h1,
.article-hero h1,
.city-detail-hero h1,
.compare-hero h1,
.tools-hero h1 {
    max-width: 920px !important;
    color: #fff !important;
    font-size: clamp(2rem, 3.2vw, 2.7rem) !important;
    line-height: 1.08 !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
}

.hero-subtitle,
.mk-hero-subtitle,
.law-detail-hero p,
.article-hero p,
.city-detail-hero p,
.compare-hero p,
.tools-hero p {
    max-width: 780px !important;
    color: rgba(255,255,255,.76) !important;
    font-size: 1rem !important;
    line-height: 1.65 !important;
}

.tools-kicker,
.law-eyebrow,
.city-kicker,
.compare-kicker,
.announcements-kicker,
.mk-kicker {
    color: #f5d0d0 !important;
    font-size: .76rem !important;
    font-weight: 850 !important;
    letter-spacing: .04em !important;
    text-transform: uppercase !important;
}

.hero-stats-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(120px, 1fr)) !important;
    gap: .65rem !important;
}

.hero-stat-card,
.city-code,
.tools-hero-panel {
    background: rgba(255,255,255,.09) !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    border-radius: var(--mk-radius) !important;
    box-shadow: none !important;
}

.stat-icon,
.tool-icon {
    border-radius: var(--mk-radius) !important;
}

.law-filter,
.search-panel,
.city-filter,
.compare-form,
.mk-search-panel,
.mk-official-search,
.mk-aym-form {
    padding: 1rem !important;
    border-radius: var(--mk-radius-lg) !important;
    background: var(--mk-surface) !important;
    border: 1px solid var(--mk-line) !important;
    box-shadow: var(--mk-shadow) !important;
}

.law-panel,
.city-verified-panel,
.mk-link-list,
.mk-results-panel,
.mk-aym-results,
.compare-table-wrap,
.result-group {
    padding: clamp(1rem, 2vw, 1.25rem) !important;
}

.quick-strip,
.tools-dashboard,
.insight-grid,
.law-topic-grid,
.law-grid,
.city-grid,
.city-note-grid,
.city-pros-cons,
.district-compare-grid,
.compare-notes,
.mk-source-tabs,
.mk-announcement-rows {
    gap: 1rem !important;
}

.quick-card,
.tool-card,
.law-card,
.law-topic-card,
.city-card,
.district-card,
.compare-notes article,
.mk-announcement-row,
.mk-result-row,
.result-card {
    border-radius: var(--mk-radius-lg) !important;
}

.tool-card h3,
.law-card h3,
.law-topic-card h3,
.city-card h2,
.mk-result-row h3,
.mk-row-title,
.result-title {
    color: var(--mk-ink) !important;
    letter-spacing: 0 !important;
}

.tool-card p,
.law-card p,
.law-topic-card p,
.city-card p,
.district-card p,
.mk-result-row p,
.result-body p {
    color: var(--mk-muted) !important;
}

.tone-primary .tool-icon,
.tone-blue .tool-icon,
.tone-green .tool-icon,
.tone-amber .tool-icon,
.tone-slate .tool-icon,
.tone-red .tool-icon {
    background: #fff7f7 !important;
    color: var(--mk-brand) !important;
}

.law-warning,
.city-warning,
.compare-warning,
.article-warning,
.mk-warning-box {
    background: #fff8eb !important;
    border-color: #f1dcc0 !important;
    color: #7c4a03 !important;
}

.city-message {
    padding: 2rem !important;
    border: 1px solid var(--mk-line, #e4dfd7) !important;
    border-radius: var(--mk-radius-lg, 10px) !important;
    background: #fff !important;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24,24,27,.07)) !important;
}

@media (max-width: 900px) {
    .hero-content,
    .mk-hero-content,
    .city-detail-layout,
    .compare-hero-layout,
    .law-detail-layout,
    .article-hero-layout {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .hero-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100% !important;
    }
}

@media (max-width: 640px) {
    .hero-stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Phase 3: theme lock for legacy inline page styles */
.announcements-hero,
.tools-hero,
.city-hero,
.city-detail-hero,
.compare-hero,
.law-hero,
.search-hero {
    background:
        linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%) !important;
    border: 1px solid rgba(255,255,255,.09) !important;
    color: #fff !important;
}

.hero-bg-pattern,
.mk-hero-bg-wave {
    display: none !important;
}

.tools-kicker,
.city-kicker,
.compare-kicker,
.announcements-kicker,
.law-eyebrow,
.mk-kicker,
.section-head span,
.tools-roadmap span,
.wide-row span,
.mk-document-head span,
.info-category-strip strong,
.info-related-item small {
    color: #f5d0d0 !important;
    letter-spacing: .04em !important;
}

.section-head span,
.wide-row span {
    color: var(--mk-brand) !important;
}

.section-head a,
.side-head a,
.mk-row-title:hover,
.city-card-foot span,
.city-metric-value,
.metric-value,
.quality-okunabilir,
.source-mode-badge,
.topic-source,
.article-source-meta strong,
.law-result-meta strong,
.city-source-strip strong,
.compare-card-value,
.district-population strong {
    color: var(--mk-brand) !important;
}

a.hero-primary,
a.hero-secondary,
a.tools-action,
.hero-secondary,
.mk-row-action a,
.mk-search-form button,
.mk-ghost-button,
.mk-official-search button,
.mk-form-actions button,
.mk-form-actions a,
.mk-document-tools a,
.mk-document-tools button,
.mk-result-actions a,
.mk-results-head a,
.mk-primary-link,
.mk-secondary-link,
.city-filter button,
.city-card-foot a,
.compare-form button,
.law-filter button,
.search-form button,
.save-form button {
    min-height: 42px !important;
    border-radius: var(--mk-radius) !important;
    font-weight: 850 !important;
    letter-spacing: 0 !important;
    box-shadow: none !important;
}

a.hero-primary,
a.tools-action,
.mk-row-action a,
.mk-search-form button,
.mk-official-search button,
.mk-form-actions button,
.mk-result-actions a,
.mk-results-head a,
.mk-primary-link,
.city-filter button,
.city-card-foot a,
.compare-form button,
.law-filter button,
.search-form button,
.save-form button {
    background: var(--mk-brand) !important;
    border-color: var(--mk-brand) !important;
    color: #fff !important;
}

a.hero-primary:hover,
a.tools-action:hover,
.mk-row-action a:hover,
.mk-search-form button:hover,
.mk-official-search button:hover,
.mk-form-actions button:hover,
.mk-result-actions a:hover,
.mk-results-head a:hover,
.mk-primary-link:hover,
.city-filter button:hover,
.city-card-foot a:hover,
.compare-form button:hover,
.law-filter button:hover,
.search-form button:hover,
.save-form button:hover {
    background: var(--mk-brand-strong) !important;
    color: #fff !important;
    transform: translateY(-1px) !important;
}

a.hero-secondary,
.hero-secondary,
.mk-ghost-button,
.mk-form-actions a,
.mk-document-tools a,
.mk-document-tools button,
.mk-secondary-link,
.mk-pagination a {
    background: #fff !important;
    border: 1px solid var(--mk-line-strong) !important;
    color: var(--mk-ink-soft) !important;
}

.hero-secondary {
    background: rgba(255,255,255,.10) !important;
    border-color: rgba(255,255,255,.18) !important;
    color: #fff !important;
}

.hero-stat-card .stat-icon,
.city-card-top span,
.tool-icon,
.info-badge--green,
.info-outcome--positive,
.tier-official_full,
.mk-result-row strong,
.mk-tab.is-active small {
    background: #fff7f7 !important;
    color: var(--mk-brand) !important;
    border-color: #f5d0d0 !important;
}

.mk-tab.is-active,
.mk-result-row.is-selected,
.info-quick-grid a:hover,
.info-quick-grid a.active,
.info-category-strip a:hover,
.info-category-strip a.active {
    background: #fff7f7 !important;
    border-color: rgba(127, 29, 29, .34) !important;
    color: var(--mk-brand) !important;
}

.tools-roadmap {
    background: var(--mk-navy) !important;
    border-radius: var(--mk-radius-lg) !important;
    box-shadow: var(--mk-shadow-lg) !important;
}

.city-filter input:focus,
.city-filter select:focus,
.compare-form select:focus,
.law-filter input:focus,
.law-filter select:focus,
.search-form input:focus,
.mk-search-form input:focus,
.mk-official-search input:focus,
.mk-aym-form input:focus {
    border-color: rgba(127, 29, 29, .55) !important;
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .10) !important;
}

/* Phase 4 migrated page-local CSS: mevzuat, city guide, city compare */

/* Migrated from mevzuat.php */
/* LAW PAGE - XenForo Design 2026 */

.law-page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    font-family: var(--font-sans);
}

/* ========== HERO ========== */
.law-hero {
    position: relative;
    background: linear-gradient(135deg,rgba(17,24,39,.96) 0%,rgba(39,39,42,.98) 52%,rgba(127,29,29,.95) 100%);
    border-radius: var(--mk-radius-lg,10px);
    padding: 2.5rem;
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: var(--mk-shadow-lg);
    animation: pageFadeInUp 0.6s ease-out;
}

.hero-bg-pattern {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(255,255,255,0.06) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(255,255,255,0.04) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}

.hero-left {
    display: flex;
    flex-direction: column;
}

.law-back {
    display: inline-flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}

.law-back:hover {
    color: #fff;
}

.hero-title {
    font-size: 2.25rem !important;
    font-weight: 900 !important;
    color: white !important;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
    margin: 0.25rem 0 0;
}

/* Hero Stats */
.hero-stats-grid {
    display: flex;
    gap: 0.75rem;
}

.hero-stat-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.hero-stat-card .stat-icon {
    font-size: 1.25rem;
}

.hero-stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.hero-stat-card .stat-denominator {
    font-size: .8rem;
    font-weight: 600;
    opacity: .75;
}

.hero-stat-card .stat-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

/* ========== SEARCH PANEL ========== */
.law-search-panel {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 0.75rem;
    align-items: center;
    margin: 0 0 1rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.law-search-input {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.8rem 0.95rem;
    background: #fff;
}

.law-search-input svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}

.law-search-input input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
}

.law-filter-selects {
    display: flex;
    gap: 0.5rem;
}

.law-search-panel select {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.8rem 0.95rem;
    background: #fff;
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.law-search-panel select:hover {
    border-color: var(--navy-300);
}

.law-search-panel button {
    border: 0;
    border-radius: var(--radius-md);
    padding: 0.8rem 1.5rem;
    background: var(--mk-brand,#7f1d1d);
    color: #fff;
    cursor: pointer;
    font-weight: 800;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}

.law-search-panel button:hover {
    transform: translateY(-1px);
    background: var(--mk-brand-strong,#5f1515);
    box-shadow: none;
}

/* ========== QUICK LINKS PILLS ========== */
.law-quick-links-new {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.quick-links-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.quick-link-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.quick-link-pill:hover {
    border-color: var(--navy-300);
    background: var(--stone-50);
    transform: translateY(-1px);
}

/* ========== INFO NOTE ========== */
.law-info-note {
    background: rgba(30, 58, 138, 0.03);
    border: 1px dashed rgba(30, 58, 138, 0.15);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 2rem;
    font-size: 0.82rem;
    color: #1e3a8a;
    line-height: 1.5;
}

/* ========== PANELS & GRIDS ========== */
.law-panel {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.section-head h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 800;
}

.section-head p {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.section-head > span {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Topic Grid */
.law-topic-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.law-topic-card {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 240px;
    transition: all 0.2s ease;
}

.law-topic-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--navy-200);
}

.law-topic-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.law-topic-meta span {
    padding: 0.32rem 0.58rem;
    border-radius: 999px;
    background: #fff7f7;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 900;
    font-size: 0.75rem;
}

.law-topic-meta small {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.78rem;
}

.law-topic-card h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.4;
}

.law-topic-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
}

.law-topic-card blockquote {
    margin: 0;
    padding: 0.6rem 0.8rem;
    border-left: 3px solid var(--mk-brand,#7f1d1d);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.5;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.law-topic-card a, .law-result-row a, .law-card-foot a, .law-empty a {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-md);
    background: var(--mk-brand,#7f1d1d);
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.82rem;
    transition: all 0.2s ease;
}

.law-topic-card a:hover, .law-result-row a:hover, .law-card-foot a:hover, .law-empty a:hover {
    background: var(--mk-brand-strong,#5f1515);
    transform: translateY(-1px);
}

/* Category Strip */
.law-category-strip {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.law-category-strip a {
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    background: var(--bg-base);
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.law-category-strip a:hover {
    border-color: var(--navy-300);
    color: var(--text-primary);
}

.law-category-strip a.active {
    border-color: rgba(127,29,29,.34);
    background: #fff7f7;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 700;
}

.law-category-strip strong {
    display: block;
    font-size: 0.88rem;
}

.law-category-strip small {
    display: block;
    margin-top: 0.125rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Law Card Grid (Catalogue) */
.law-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.law-card {
    background: var(--bg-base);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 200px;
    transition: all 0.2s ease;
}

.law-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--navy-200);
}

.law-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.law-card-top span {
    padding: 0.32rem 0.58rem;
    border-radius: 999px;
    background: var(--stone-100);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.75rem;
}

.law-card-top small {
    font-weight: 700;
    font-size: 0.75rem;
}

.quality-okunabilir { color: var(--mk-brand,#7f1d1d); }
.quality-kaynak { color: var(--mk-ink-soft,#334155); }
.quality-bekliyor { color: #b45309; }

.law-card h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.4;
}

.law-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.law-card-foot {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.law-card-foot span {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.78rem;
}

/* Result rows */
.law-result-list {
    display: grid;
    gap: 0.65rem;
}

.law-result-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    background: var(--bg-base);
}

.law-result-row strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
}

.law-result-row span {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
}

.law-row-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.law-row-actions small {
    padding: 0.32rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.tier-official_full { background: #fff7f7; color: var(--mk-brand,#7f1d1d); }
.tier-editorial_summary { background: #eff6ff; color: #1e40af; }
.tier-stub { background: #fff7ed; color: #9a3412; }
.tier-empty { background: #f8fafc; color: #475569; }

/* Empty state */
.law-empty {
    padding: 2.5rem 1.5rem;
    border-radius: var(--radius-lg);
    background: var(--bg-base);
    border: 1px dashed var(--border-light);
    text-align: center;
}

.law-empty h3 {
    margin: 0 0 0.35rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 800;
}

.law-empty p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}

.law-empty-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .hero-stats-grid {
        flex-wrap: wrap;
    }

    .law-search-panel {
        grid-template-columns: 1fr;
    }

    .law-filter-selects {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .law-search-panel button {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .law-topic-grid, .law-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .law-page-container {
        padding: 1rem;
    }
    
    .law-hero {
        padding: 1.5rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-stats-grid {
        flex-direction: column;
    }

    .law-topic-grid, .law-grid {
        grid-template-columns: 1fr;
    }

    .section-head, .law-result-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .law-row-actions {
        width: 100%;
        margin-top: 0.75rem;
        justify-content: space-between;
    }
}

/* Migrated from il-rehberi.php */
@keyframes mkFadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mk-cities-main {
    background: transparent;
    min-height: 100vh;
}

.city-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.city-hero {
    position: relative;
    background: linear-gradient(135deg,rgba(17,24,39,.96) 0%,rgba(39,39,42,.98) 52%,rgba(127,29,29,.95) 100%);
    border-radius: var(--mk-radius-lg,10px);
    padding: 2.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    box-shadow: var(--mk-shadow-lg);
    animation: mkFadeInUp 0.6s ease-out;
    color: #fff;
}

.hero-bg-pattern {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 10% 20%,rgba(255,255,255,0.06) 0%,transparent 50%),radial-gradient(circle at 90% 80%,rgba(255,255,255,0.04) 0%,transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}

.hero-left {
    display: flex;
    flex-direction: column;
}

.city-kicker {
    display: inline-flex;
    margin-bottom: .5rem;
    color: #f5d0d0;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.hero-title {
    font-size: 2.25rem!important;
    font-weight: 900!important;
    color: white!important;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
    margin: 0.5rem 0 0;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1.25rem;
}

.hero-secondary {
    padding: .75rem 1.25rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 900;
    font-size: .875rem;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: #fff;
}

.hero-secondary:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-1px);
}

.hero-stats-grid {
    display: flex;
    gap: 0.75rem;
}

.hero-stat-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.hero-stat-card .stat-icon {
    font-size: 1.25rem;
    color: #f5d0d0;
}

.hero-stat-card .stat-data {
    display: flex;
    flex-direction: column;
}

.hero-stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.hero-stat-card .stat-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-top: .15rem;
}

.city-detail-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    padding: 16px;
    color: #78350f;
    font-size: 0.95rem;
    line-height: 1.6;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.08s;
}

.city-detail-warning strong {
    font-weight: 800;
    color: #92400e;
}

.experience-alert {
    padding: 1rem;
    border-radius: var(--radius-lg);
    font-weight: 900;
    animation: mkFadeInUp 0.5s ease-out;
}

.experience-alert.success {
    background: #fff7f7;
    border: 1px solid #f5d0d0;
    color: var(--mk-brand,#7f1d1d);
}

.experience-alert.danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.city-metric-grid,
.city-custom-metrics {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.75rem;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.1s;
}

.city-custom-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.city-metric-grid div,
.city-custom-metrics div,
.decision-summary-card,
.decision-score-card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15,23,42,0.02);
    transition: all 0.2s ease;
}

.city-metric-grid div:hover,
.city-custom-metrics div:hover,
.decision-score-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.city-metric-grid strong,
.city-metric-grid span,
.city-custom-metrics strong,
.city-custom-metrics span,
.decision-summary-card strong,
.decision-summary-card span,
.decision-summary-card small,
.decision-score-card strong,
.decision-score-card span {
    display: block;
}

.city-metric-grid strong,
.city-custom-metrics strong,
.decision-summary-card strong,
.decision-score-card strong {
    font-size: 1.5rem;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
}

.city-metric-grid span,
.city-custom-metrics span,
.decision-summary-card span,
.decision-summary-card small,
.decision-score-card span {
    color: #64748b;
    font-weight: 700;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.city-decision-panel {
    display: grid;
    grid-template-columns: 1.4fr repeat(5, 1fr);
    gap: 0.75rem;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.12s;
}

.decision-summary-card {
    background: #fff7f7;
    border-color: #f5d0d0;
}

.decision-summary-card strong {
    color: var(--mk-brand,#7f1d1d);
}

.city-source-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.14s;
}

.city-source-strip > div {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid #f5d0d0;
    background: #fff7f7;
}

.city-source-strip > div.is-waiting {
    border-color: #fed7aa;
    background: #fff7ed;
}

.city-source-strip strong,
.city-source-strip span,
.city-source-strip a {
    display: block;
}

.city-source-strip strong {
    color: var(--mk-brand,#7f1d1d);
    font-size: 0.95rem;
    font-weight: 800;
}

.city-source-strip .is-waiting strong {
    color: #c2410c;
}

.city-source-strip span {
    margin-top: 0.25rem;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.5;
}

.city-source-strip a {
    margin-top: 0.5rem;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
    text-decoration: none;
    font-size: 0.85rem;
}

.city-source-strip a:hover {
    text-decoration: underline;
}

.city-verified-panel {
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.16s;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.section-head h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.35rem;
    font-weight: 800;
}

.section-head span {
    color: #64748b;
    font-weight: 700;
    font-size: 0.9rem;
}

.verified-panel-note {
    margin: 0 0 1rem;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.6;
}

.verified-group-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    margin-top: 0.85rem;
    box-shadow: 0 4px 12px rgba(15,23,42,0.01);
}

.verified-group-card h3 {
    margin: 0 0 1rem;
    color: #0f172a;
    font-size: 1.1rem;
    font-weight: 800;
}

.verified-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.verified-metric-card {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid #e2e8f0;
}

.verified-metric-card span,
.verified-metric-card strong,
.verified-metric-card small,
.verified-metric-card a {
    display: block;
}

.verified-metric-card span {
    color: #64748b;
    font-weight: 700;
    font-size: 0.8rem;
}

.verified-metric-card strong {
    margin-top: 0.25rem;
    font-size: 1.4rem;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
}

.verified-metric-card p {
    margin: 0.5rem 0;
    color: #475569;
    font-size: 0.88rem;
    line-height: 1.5;
}

.verified-metric-card small {
    color: #64748b;
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.verified-metric-card a {
    margin-top: 0.5rem;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
    text-decoration: none;
    font-size: 0.8rem;
}

.verified-metric-card a:hover {
    text-decoration: underline;
}

.city-note-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.18s;
}

.city-note-card,
.city-pros-cons article {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15,23,42,0.02);
}

.city-note-card h2,
.city-pros-cons h2 {
    margin: 0 0 0.75rem;
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 800;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 0.5rem;
}

.city-note-card p,
.city-pros-cons p {
    margin: 0;
    color: #475569;
    line-height: 1.65;
    font-size: 0.95rem;
}

.city-pros-cons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.2s;
}

.district-section {
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.22s;
}

.district-card,
.experience-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(15,23,42,0.02);
    margin-bottom: 1rem;
}

.district-card-head,
.experience-card-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.district-card-head h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 800;
}

.district-card-head span,
.experience-card-head > span {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: #fff7f7;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
    font-size: 0.85rem;
}

.district-population-strip {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin: 0.5rem 0 0.75rem;
}

.district-population-strip span,
.district-population-strip a {
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #fff7f7;
    border: 1px solid #f5d0d0;
    color: var(--mk-brand,#7f1d1d);
    font-size: 0.8rem;
    font-weight: 800;
    text-decoration: none;
}

.district-population-strip strong {
    color: var(--mk-brand-strong,#5f1515);
}

.district-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0.5rem 0 0.75rem;
}

.district-tags span {
    padding: 0.32rem 0.6rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 800;
}

.district-card p {
    margin: 0;
    color: #475569;
    line-height: 1.65;
    font-size: 0.95rem;
}

.district-note-grid,
.district-pros-cons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.district-note-grid div,
.district-pros-cons div {
    padding: 1rem;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.district-note-grid strong,
.district-note-grid span,
.district-pros-cons strong,
.district-pros-cons span {
    display: block;
}

.district-note-grid strong,
.district-pros-cons strong {
    color: #0f172a;
    font-weight: 800;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.district-note-grid span,
.district-pros-cons span {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
}

.experience-section {
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.24s;
}

.experience-card-head strong {
    display: block;
    color: #0f172a;
    font-size: 1.15rem;
    font-weight: 800;
}

.experience-card-head div span {
    margin-top: 0.25rem;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
    display: block;
}

.experience-card p {
    margin: 1rem 0 0;
    color: #475569;
    line-height: 1.65;
    font-size: 0.95rem;
}

.experience-form {
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    box-shadow: 0 4px 12px rgba(15,23,42,0.02);
    margin-top: 1.5rem;
}

.experience-form h3 {
    margin: 0 0 0.35rem;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 800;
}

.experience-form p {
    margin: 0 0 1.25rem;
    color: #64748b;
    font-size: 0.9rem;
}

.experience-form label {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 1rem;
    color: #334155;
    font-weight: 800;
    font-size: 0.9rem;
}

.experience-form input,
.experience-form select,
.experience-form textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    font: inherit;
    background: #fff;
    color: #0f172a;
    transition: all 0.2s ease;
}

.experience-form input:focus,
.experience-form select:focus,
.experience-form textarea:focus {
    border-color: rgba(127,29,29,.55);
    outline: none;
    box-shadow: 0 0 0 3px rgba(127,29,29,0.1);
}

.experience-form-grid {
    display: grid;
    grid-template-columns: 1.2fr .8fr .9fr .45fr;
    gap: 0.75rem;
}

.experience-form-grid.small {
    grid-template-columns: 1fr 1fr;
}

.experience-form button {
    border: 0;
    border-radius: var(--radius-md);
    background: var(--mk-brand,#7f1d1d);
    color: #fff;
    padding: 0.8rem 1.5rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
}

.experience-form button:hover {
    background: var(--mk-brand-strong,#5f1515);
    transform: translateY(-1px);
}

.check-line {
    display: flex !important;
    align-items: center;
    gap: 0.55rem !important;
    cursor: pointer;
}

.check-line input {
    width: auto;
}

.district-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    color: #64748b;
    font-size: 0.95rem;
}

@media(max-width:980px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .hero-stats-grid {
        flex-wrap: wrap;
    }

    .city-metric-grid,
    .city-custom-metrics,
    .city-note-grid,
    .city-decision-panel,
    .city-pros-cons,
    .district-note-grid,
    .district-pros-cons,
    .experience-form-grid,
    .experience-form-grid.small {
        grid-template-columns: 1fr;
    }

    .district-card-head,
    .experience-card-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

@media(max-width:640px) {
    .city-page {
        padding: 1rem;
    }
}

/* Migrated from il-karsilastir.php */
@keyframes mkFadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mk-compare-main {
    background: linear-gradient(180deg,#f8fafc 0%,#fff 38%);
    min-height: 100vh;
}

.compare-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.compare-hero {
    position: relative;
    background: linear-gradient(135deg,rgba(17,24,39,.96) 0%,rgba(39,39,42,.98) 52%,rgba(127,29,29,.95) 100%);
    border-radius: var(--mk-radius-lg,10px);
    padding: 2.5rem;
    margin-bottom: 0.5rem;
    overflow: hidden;
    box-shadow: var(--mk-shadow-lg);
    animation: mkFadeInUp 0.6s ease-out;
    color: #fff;
}

.hero-bg-pattern {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at 10% 20%,rgba(255,255,255,0.06) 0%,transparent 50%),radial-gradient(circle at 90% 80%,rgba(255,255,255,0.04) 0%,transparent 50%);
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
}

.hero-left {
    display: flex;
    flex-direction: column;
}

.compare-kicker {
    display: inline-flex;
    margin-bottom: .5rem;
    color: #f5d0d0;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.hero-title {
    font-size: 2.25rem!important;
    font-weight: 900!important;
    color: white!important;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hero-subtitle {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
    margin: 0.5rem 0 0;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1.25rem;
}

.hero-secondary {
    padding: .75rem 1.25rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 900;
    font-size: .875rem;
    transition: all .2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: #fff;
}

.hero-secondary:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-1px);
}

.hero-stats-grid {
    display: flex;
    gap: 0.75rem;
}

.hero-stat-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.hero-stat-card .stat-icon {
    font-size: 1.25rem;
    color: #f5d0d0;
}

.hero-stat-card .stat-data {
    display: flex;
    flex-direction: column;
}

.hero-stat-card .stat-value {
    font-size: 1.25rem;
    font-weight: 900;
    color: white;
    line-height: 1;
}

.hero-stat-card .stat-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-top: .15rem;
}

.compare-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    padding: 16px;
    color: #78350f;
    font-size: 0.95rem;
    line-height: 1.6;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.08s;
}

.compare-warning strong {
    font-weight: 800;
    color: #92400e;
}

.compare-form {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: 0 4px 12px rgba(15,23,42,0.02);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 1rem;
    align-items: end;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.14s;
}

.compare-form label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 800;
    font-size: 0.9rem;
}

.compare-form select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    font: inherit;
    background-color: #fff;
    color: #0f172a;
    transition: all 0.2s ease;
}

.compare-form select:focus {
    border-color: rgba(127,29,29,.55);
    outline: none;
    box-shadow: 0 0 0 3px rgba(127,29,29,0.1);
}

.compare-form button {
    border: 0;
    border-radius: var(--radius-md);
    background: var(--mk-brand,#7f1d1d);
    color: #fff;
    padding: 0 1.5rem;
    font-weight: 800;
    height: 46px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.compare-form button:hover {
    background: var(--mk-brand-strong,#5f1515);
    transform: translateY(-1px);
}

.compare-empty {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 3rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(15,23,42,0.02);
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.2s;
}

.compare-empty h2 {
    color: #0f172a;
    margin: 0 0 0.5rem;
    font-size: 1.35rem;
    font-weight: 800;
}

.compare-empty p {
    color: #64748b;
    margin: 0 0 1.5rem;
}

.compare-empty a {
    display: inline-flex;
    align-items: center;
    background: var(--mk-brand,#7f1d1d);
    border-radius: var(--radius-md);
    color: #fff;
    padding: 0 1.5rem;
    font-weight: 800;
    height: 46px;
    text-decoration: none;
    box-shadow: none;
    transition: all 0.2s ease;
}

.compare-empty a:hover {
    background: var(--mk-brand-strong,#5f1515);
    transform: translateY(-1px);
}

.compare-table-wrap {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 12px rgba(15,23,42,0.02);
    overflow: auto;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.2s;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.compare-table th,
.compare-table td {
    padding: 1.15rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}

.compare-table th {
    background: #f8fafc;
    color: #0f172a;
    font-size: 1rem;
}

.compare-table th strong {
    font-weight: 800;
    display: block;
    color: #0f172a;
    font-size: 1.15rem;
}

.compare-table th span {
    color: #64748b;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-top: 0.25rem;
}

.compare-table td:first-child {
    font-weight: 800;
    color: #334155;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
}

.compare-table td {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.6;
}

.compare-table td strong {
    color: #0f172a;
    font-weight: 800;
}

.compare-table td .muted, .muted {
    display: block;
    margin-top: .25rem;
    color: #64748b;
    font-size: .84rem;
    font-weight: 600;
}

.compare-table td .source-link {
    display: inline-flex;
    margin-top: .35rem;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.compare-table td .source-link:hover {
    color: var(--mk-brand-strong,#5f1515);
    text-decoration: underline;
}

.verified-section-row td {
    background: #fff7f7!important;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
    border-top: 2px solid #f5d0d0;
    border-bottom: 2px solid #f5d0d0;
}

.pill {
    display: inline-flex;
    padding: .35rem .75rem;
    border-radius: 999px;
    background: #fff7f7;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
    font-size: 0.85rem;
}

.score-bar {
    height: 8px;
    border: 0;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-bottom: .4rem;
    width: 100px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
    appearance: none;
}

.score-bar span {
    display: block;
    height: 100%;
    background: var(--mk-brand,#7f1d1d);
}

.score-bar::-webkit-progress-bar {
    border-radius: inherit;
    background: #e2e8f0;
}

.score-bar::-webkit-progress-value,
.score-bar::-moz-progress-bar {
    border-radius: inherit;
    background: var(--mk-brand,#7f1d1d);
}

.compare-notes {
    display: grid;
    gap: 1.5rem;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.24s;
}

.compare-notes article,
.compare-districts {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 4px 12px rgba(15,23,42,.02);
}

.compare-notes h2 {
    margin: 0 0 1rem;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 800;
}

.note-grid {
    display: grid;
    gap: 1rem;
}

.note-grid.compare-cols-1,
.district-compare-grid.compare-cols-1 {
    grid-template-columns: minmax(0, 1fr);
}

.note-grid.compare-cols-2,
.district-compare-grid.compare-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.note-grid.compare-cols-3,
.district-compare-grid.compare-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.note-grid div {
    padding: 1rem;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.note-grid strong {
    display: block;
    margin-bottom: .5rem;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
    font-size: 1.15rem;
}

.note-grid p {
    margin: 0;
    color: #475569;
    line-height: 1.6;
    font-size: 0.95rem;
}

.compare-districts {
    margin-top: 0.5rem;
    animation: mkFadeInUp 0.5s ease-out both;
    animation-delay: 0.28s;
}

.compare-section-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.75rem;
}

.compare-section-head h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.35rem;
    font-weight: 800;
}

.compare-section-head span {
    color: #64748b;
    font-weight: 700;
    font-size: 0.9rem;
}

.district-compare-grid {
    display: grid;
    gap: 1rem;
}

.district-compare-grid > article {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.district-compare-grid h3 {
    margin: 0 0 1rem;
    color: #0f172a;
    font-weight: 800;
    font-size: 1.2rem;
}

.district-mini-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.75rem;
}

.district-mini-card div {
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    align-items: center;
}

.district-mini-card strong {
    font-weight: 800;
    color: #0f172a;
    font-size: 1rem;
}

.district-mini-card span {
    font-weight: 800;
    color: var(--mk-brand,#7f1d1d);
    font-size: 0.9rem;
}

.district-mini-card p {
    margin: .5rem 0 0;
    color: #475569;
    line-height: 1.6;
    font-size: 0.92rem;
}

.district-mini-card small {
    display: block;
    margin-top: .5rem;
    color: #64748b;
    font-weight: 700;
    font-size: 0.8rem;
}

.district-missing {
    margin: 0;
    color: #64748b;
    line-height: 1.6;
}

.district-more-link {
    display: inline-flex;
    margin-top: .5rem;
    color: var(--mk-brand,#7f1d1d);
    font-weight: 800;
    text-decoration: none;
    font-size: 0.9rem;
}

.district-more-link:hover {
    color: var(--mk-brand-strong,#5f1515);
    text-decoration: underline;
}

@media(max-width:900px) {
    .compare-page {
        padding: 1rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .hero-stats-grid {
        flex-wrap: wrap;
    }

    .compare-form {
        grid-template-columns: 1fr;
    }

    .note-grid,
    .district-compare-grid {
        grid-template-columns: 1fr!important;
    }

    .compare-section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Phase 5: process center shared layout */
.tools-page {
    width: min(100% - (var(--page-gutter, 1.25rem) * 2), var(--content-wide, 1400px));
    max-width: none;
    margin: 0 auto;
    padding: clamp(1rem, 2.5vw, 2rem) 0 3rem;
    background: transparent;
}

.tools-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    padding: clamp(1.35rem, 3vw, 2.25rem);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17,24,39,.96) 0%, rgba(39,39,42,.98) 52%, rgba(127,29,29,.95) 100%);
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17,24,39,.15));
    color: #fff;
    animation: pageFadeInUp .6s ease-out;
}

.tools-page .hero-bg-pattern {
    display: none;
}

.tools-page .hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(1rem, 3vw, 2rem);
    align-items: center;
}

.tools-page .hero-left {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.tools-kicker,
.tools-page .section-head span,
.tools-roadmap span {
    display: inline-flex;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.tools-kicker {
    margin-bottom: .5rem;
    color: #f5d0d0;
}

.tools-page .hero-title {
    max-width: 920px;
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    line-height: 1.08;
    font-weight: 900;
    letter-spacing: 0;
    text-shadow: none;
}

.tools-page .hero-subtitle {
    max-width: 780px;
    margin: .5rem 0 0;
    color: rgba(255,255,255,.76);
    font-size: 1rem;
    line-height: 1.65;
}

.tools-page .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1.25rem;
}

.tools-page .hero-primary,
.tools-page .hero-secondary,
.tools-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .72rem 1rem;
    border-radius: var(--mk-radius, 8px);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 900;
    transition: transform .15s, background .18s, border-color .18s, color .18s;
}

.tools-page .hero-primary {
    border: 1px solid var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.tools-page .hero-primary:hover {
    border-color: var(--mk-brand-strong, #5f1515);
    background: var(--mk-brand-strong, #5f1515);
    transform: translateY(-1px);
}

.tools-page .hero-secondary {
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.10);
    color: #fff;
}

.tools-page .hero-secondary:hover {
    background: rgba(255,255,255,.18);
    transform: translateY(-1px);
}

.tools-page .hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: .65rem;
}

.tools-page .hero-stat-card {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .75rem 1rem;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255,255,255,.09);
    box-shadow: none;
}

.tools-page .hero-stat-card .stat-icon {
    color: #f5d0d0;
    font-size: 1.25rem;
}

.tools-page .hero-stat-card .stat-data {
    display: flex;
    flex-direction: column;
}

.tools-page .hero-stat-card .stat-value {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 900;
    line-height: 1;
}

.tools-page .hero-stat-card .stat-label {
    margin-top: .15rem;
    color: rgba(255,255,255,.70);
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.quick-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .9rem;
    margin-top: 1rem;
}

.quick-card,
.tool-card,
.side-card,
.insight-card,
.mini-row,
.wide-row {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    box-shadow: var(--mk-shadow-sm, 0 8px 22px rgba(17,24,39,.06));
}

.quick-card,
.tool-card,
.mini-row,
.wide-row {
    text-decoration: none;
    transition: transform .15s, border-color .18s, box-shadow .18s;
}

.quick-card {
    padding: 1rem;
}

.quick-card:hover,
.tool-card:hover,
.wide-row:hover,
.mini-row:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 14px 28px rgba(17,24,39,.10);
    transform: translateY(-2px);
}

.quick-card span {
    display: inline-flex;
    padding: .32rem .55rem;
    border-radius: 999px;
    background: var(--mk-soft, #f8fafc);
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    font-weight: 900;
}

.quick-card strong {
    display: block;
    margin: .75rem 0 .35rem;
    font-size: 1.05rem;
}

.quick-card small {
    color: var(--mk-muted, #64748b);
    line-height: 1.5;
}

.tools-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1rem;
    margin-top: 1rem;
}

.dashboard-main,
.dashboard-side,
.insight-card {
    min-width: 0;
}

.tools-page .section-head,
.side-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 .9rem;
}

.tools-page .section-head h2,
.side-head h2 {
    margin: 0;
    color: var(--mk-ink, #18181b);
}

.tools-page .section-head h2 {
    font-size: 1.35rem;
}

.side-head h2 {
    font-size: 1.05rem;
}

.tools-page .section-head span {
    margin: 0 0 .35rem;
}

.tools-page .section-head a,
.side-head a {
    color: var(--mk-brand, #7f1d1d);
    text-decoration: none;
    font-weight: 900;
}

.tools-page .section-head a:hover,
.side-head a:hover {
    color: var(--mk-brand-strong, #5f1515);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.tool-card {
    display: flex;
    min-height: 190px;
    flex-direction: column;
    padding: 1.2rem;
}

.tool-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1rem;
}

.tool-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: var(--mk-radius, 8px);
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 900;
}

.tool-icon svg,
.tool-module-svg {
    width: 23px;
    height: 23px;
    display: block;
}

.tool-status {
    padding: .35rem .55rem;
    border-radius: 999px;
    background: var(--mk-soft, #f8fafc);
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    font-weight: 850;
}

.tool-card h3 {
    margin: 0 0 .55rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.13rem;
}

.tool-card p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.62;
}

.dashboard-side {
    display: grid;
    gap: 1rem;
}

.side-card,
.insight-card {
    padding: 1.1rem;
}

.mini-row,
.wide-row {
    display: block;
    padding: .8rem;
    background: var(--mk-soft, #f8fafc);
    box-shadow: none;
}

.mini-row + .mini-row,
.wide-row + .wide-row {
    margin-top: .55rem;
}

.mini-row strong,
.wide-row strong {
    display: block;
    margin-bottom: .28rem;
}

.mini-row span,
.wide-row small,
.empty-note {
    display: block;
    color: var(--mk-muted, #64748b);
    font-size: .88rem;
    line-height: 1.55;
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.tools-page .section-head.compact {
    align-items: center;
}

.wide-row span {
    display: inline-flex;
    margin-bottom: .42rem;
    color: var(--mk-brand, #7f1d1d);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.tools-roadmap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1.5rem;
    border-radius: var(--mk-radius-lg, 10px);
    background: var(--mk-navy, #111827);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17,24,39,.15));
}

.tools-roadmap span {
    margin-bottom: .75rem;
    color: #f5d0d0;
}

.tools-roadmap h2 {
    margin: 0 0 .45rem;
    color: #fff;
}

.tools-roadmap p {
    margin: 0;
    color: rgba(255,255,255,.78);
    line-height: 1.7;
}

.tools-action {
    flex-shrink: 0;
    border: 1px solid #fff;
    background: #fff;
    color: #0f172a;
}

.tools-action:hover {
    transform: translateY(-1px);
}

.empty-note {
    margin: .25rem 0 0;
}

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

    .quick-strip,
    .insight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media(max-width:1024px) {
    .tools-page .hero-content {
        grid-template-columns: 1fr;
    }

    .tools-page .hero-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media(max-width:680px) {
    .tools-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px));
        padding: 1rem 0 2rem;
    }

    .tools-hero {
        padding: 1.5rem;
    }

    .tools-page .hero-stats-grid,
    .quick-strip,
    .tools-grid,
    .insight-grid {
        grid-template-columns: 1fr;
    }

    .tools-page .section-head,
    .tools-roadmap,
    .side-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .tools-page .hero-actions a,
    .tools-action {
        width: 100%;
        text-align: center;
    }
}

/* Phase 6: cities index shared layout */
.mk-cities-main {
    min-height: 100vh;
    background: transparent;
}

.city-page {
    width: min(100% - (var(--page-gutter, 1.25rem) * 2), var(--content-wide, 1400px));
    max-width: none;
    margin: 0 auto;
    padding: clamp(1rem, 2.5vw, 2rem) 0 3rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.city-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(1.35rem, 3vw, 2.25rem);
    border: 1px solid rgba(255,255,255,.09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17,24,39,.96) 0%, rgba(39,39,42,.98) 52%, rgba(127,29,29,.95) 100%);
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17,24,39,.15));
    color: #fff;
    animation: pageFadeInUp .6s ease-out;
}

.city-page .hero-bg-pattern {
    display: none;
}

.city-page .hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(1rem, 3vw, 2rem);
    align-items: center;
}

.city-page .hero-left {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.city-kicker {
    display: inline-flex;
    margin-bottom: .5rem;
    color: #f5d0d0;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.city-page .hero-title {
    display: flex;
    align-items: center;
    gap: .65rem;
    max-width: 920px;
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    line-height: 1.08;
    font-weight: 900;
    letter-spacing: 0;
    text-shadow: none;
}

.city-page .hero-title svg {
    flex: 0 0 auto;
    width: 1em;
    height: 1em;
}

.city-page .hero-subtitle {
    max-width: 780px;
    margin: .5rem 0 0;
    color: rgba(255,255,255,.76);
    font-size: 1rem;
    line-height: 1.65;
}

.city-page .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1.25rem;
}

.city-page .hero-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .72rem 1rem;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255,255,255,.10);
    color: #fff;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 900;
    transition: transform .15s, background .18s, border-color .18s;
}

.city-page .hero-secondary:hover {
    background: rgba(255,255,255,.18);
    transform: translateY(-1px);
}

.city-page .hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: .65rem;
}

.city-page .hero-stat-card {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .75rem 1rem;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255,255,255,.09);
    box-shadow: none;
}

.city-page .hero-stat-card .stat-icon {
    color: #f5d0d0;
    font-size: 1.25rem;
}

.city-page .hero-stat-card .stat-data {
    display: flex;
    flex-direction: column;
}

.city-page .hero-stat-card .stat-value {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 900;
    line-height: 1;
}

.city-page .hero-stat-card .stat-label {
    margin-top: .15rem;
    color: rgba(255,255,255,.70);
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.city-warning {
    padding: .95rem 1.1rem;
    border: 1px solid #fde68a;
    border-radius: var(--mk-radius-lg, 10px);
    background: #fffbeb;
    color: #78350f;
    font-size: .94rem;
    line-height: 1.6;
    animation: pageFadeInUp .5s ease-out both;
}

.city-warning strong {
    color: #92400e;
    font-weight: 900;
}

.city-filter {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 220px auto;
    gap: .75rem;
    padding: .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 8px 22px rgba(17,24,39,.06));
    animation: pageFadeInUp .5s ease-out both;
}

.city-filter input,
.city-filter select {
    min-height: 44px;
    padding: .72rem .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    outline: none;
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    transition: border-color .18s, box-shadow .18s;
}

.city-filter input:focus,
.city-filter select:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127,29,29,.08);
}

.city-filter button,
.city-card-foot a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    font-weight: 900;
    transition: transform .15s, background .18s, border-color .18s;
}

.city-filter button {
    padding: .72rem 1.15rem;
}

.city-card-foot a {
    padding: .5rem .9rem;
    font-size: .9rem;
}

.city-filter button:hover,
.city-card-foot a:hover {
    border-color: var(--mk-brand-strong, #5f1515);
    background: var(--mk-brand-strong, #5f1515);
    transform: translateY(-1px);
}

.city-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    animation: pageFadeInUp .5s ease-out both;
}

.city-card,
.city-empty {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 8px 22px rgba(17,24,39,.06));
}

.city-card {
    display: flex;
    min-height: 280px;
    flex-direction: column;
    padding: 1.25rem;
    transition: transform .15s, border-color .18s, box-shadow .18s, opacity .18s;
}

.city-card:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 14px 28px rgba(17,24,39,.10);
    transform: translateY(-2px);
}

.city-card.is-missing {
    opacity: .82;
}

.city-card-top,
.city-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.city-card-top span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--mk-radius, 8px);
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
    font-size: 1.05rem;
    font-weight: 900;
}

.city-card-top small {
    color: var(--mk-muted, #64748b);
    font-size: .75rem;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.city-card h2 {
    margin: 1rem 0 .5rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.28rem;
    font-weight: 900;
    letter-spacing: 0;
}

.city-card p {
    margin: 0;
    color: var(--mk-ink-soft, #334155);
    font-size: .95rem;
    line-height: 1.65;
}

.city-mini-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .38rem;
    margin-top: 1rem;
}

.city-mini-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: .25rem .58rem;
    border-radius: 999px;
    background: var(--mk-soft, #f8fafc);
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 850;
}

.city-card-foot {
    margin-top: auto;
    padding-top: 1.15rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
}

.city-card-foot span {
    color: var(--mk-muted, #64748b);
    font-size: .85rem;
    font-weight: 800;
}

.city-empty {
    grid-column: 1 / -1;
    padding: clamp(2rem, 4vw, 3rem) 1.25rem;
    text-align: center;
}

.city-empty h2 {
    margin: 0 0 .5rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.25rem;
    font-weight: 900;
}

.city-empty p {
    margin: 0;
    color: var(--mk-muted, #64748b);
}

@media(max-width:980px) {
    .city-page .hero-content {
        grid-template-columns: 1fr;
    }

    .city-page .hero-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .city-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media(max-width:720px) {
    .city-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px));
        padding: 1rem 0 2rem;
    }

    .city-hero {
        padding: 1.5rem;
    }

    .city-page .hero-stats-grid,
    .city-filter,
    .city-grid {
        grid-template-columns: 1fr;
    }

    .city-card-foot {
        flex-direction: column;
        align-items: flex-start;
    }

    .city-card-foot a,
    .city-filter button,
    .city-page .hero-actions a {
        width: 100%;
        text-align: center;
    }
}

/* Phase 7: legal detail, topic, and article pages */
.law-detail-page,
.topic-page,
.article-page {
    width: min(100% - (var(--page-gutter, 1.25rem) * 2), var(--content-wide, 1400px)) !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: clamp(1rem, 2.5vw, 2rem) 0 3rem !important;
    background: transparent !important;
}

.law-detail-hero,
.topic-hero,
.article-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(1.35rem, 3vw, 2.25rem) !important;
    border: 1px solid rgba(255,255,255,.09) !important;
    border-radius: var(--mk-radius-lg, 10px) !important;
    background: linear-gradient(135deg, rgba(17,24,39,.96) 0%, rgba(39,39,42,.98) 52%, rgba(127,29,29,.95) 100%) !important;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17,24,39,.15)) !important;
    color: #fff !important;
}

.law-back,
.topic-back,
.article-back {
    display: inline-flex;
    margin-bottom: 1rem;
    color: #f5d0d0 !important;
    text-decoration: none;
    font-weight: 900;
}

.law-back:hover,
.topic-back:hover,
.article-back:hover {
    color: #fff !important;
}

.law-detail-layout,
.topic-hero-grid,
.article-hero-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(1rem, 3vw, 2rem);
    align-items: center;
}

.law-detail-hero h1,
.topic-hero h1,
.article-hero h1 {
    max-width: 920px;
    margin: 0 0 .55rem;
    color: #fff !important;
    font-size: clamp(2rem, 3.2vw, 2.7rem) !important;
    line-height: 1.08 !important;
    font-weight: 900;
    letter-spacing: 0 !important;
    text-shadow: none !important;
}

.law-detail-hero p,
.topic-hero p,
.article-hero p {
    max-width: 780px;
    margin: 0;
    color: rgba(255,255,255,.76) !important;
    font-size: 1rem;
    line-height: 1.65;
}

.topic-hero span {
    display: inline-flex;
    margin-bottom: .45rem;
    color: #f5d0d0 !important;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.topic-hero aside {
    min-width: 160px;
    padding: .9rem 1rem;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255,255,255,.09);
    text-align: center;
}

.topic-hero aside strong,
.topic-hero aside small {
    display: block;
}

.topic-hero aside strong {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 900;
    line-height: 1;
}

.topic-hero aside small {
    margin-top: .2rem;
    color: rgba(255,255,255,.70);
    font-size: .72rem;
    font-weight: 850;
    text-transform: uppercase;
}

.law-detail-layout > a,
.article-hero-layout > a,
.law-source-actions a,
.article-source-actions a,
.article-stub-actions a,
.article-row-actions a,
.empty-box a,
.topic-primary,
.topic-article > a,
.topic-filter button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .65rem 1rem;
    border: 1px solid var(--mk-brand, #7f1d1d) !important;
    border-radius: var(--mk-radius, 8px) !important;
    background: var(--mk-brand, #7f1d1d) !important;
    color: #fff !important;
    text-decoration: none;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: none !important;
    transition: transform .15s, background .18s, border-color .18s;
}

.law-detail-layout > a:hover,
.article-hero-layout > a:hover,
.law-source-actions a:hover,
.article-source-actions a:hover,
.article-stub-actions a:hover,
.article-row-actions a:hover,
.empty-box a:hover,
.topic-primary:hover,
.topic-article > a:hover,
.topic-filter button:hover {
    border-color: var(--mk-brand-strong, #5f1515) !important;
    background: var(--mk-brand-strong, #5f1515) !important;
    transform: translateY(-1px);
}

.law-source-actions a:last-child,
.article-source-actions a:last-child,
.article-stub-actions a:last-child,
.empty-actions a:last-child {
    border-color: var(--mk-navy, #111827) !important;
    background: var(--mk-navy, #111827) !important;
}

.law-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}

.law-meta span,
.law-source-panel,
.article-source-panel,
.article-summary,
.article-paper,
.topic-panel,
.topic-side-panel,
.topic-article,
.topic-empty,
.law-message,
.article-message,
.empty-box {
    border: 1px solid var(--mk-line, #e4dfd7) !important;
    border-radius: var(--mk-radius-lg, 10px) !important;
    background: #fff !important;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24,24,27,.07)) !important;
}

.law-meta span {
    padding: .85rem;
    color: var(--mk-muted, #64748b);
}

.law-meta strong {
    color: var(--mk-ink, #18181b);
}

.law-warning,
.article-warning,
.topic-question,
.topic-warning,
.article-stub-state {
    margin-top: 1rem;
    padding: .95rem 1rem;
    border: 1px solid #f1dcc0 !important;
    border-radius: var(--mk-radius, 8px) !important;
    background: #fff8eb !important;
    color: #7c4a03 !important;
    line-height: 1.6;
}

.law-warning strong,
.article-warning strong,
.topic-question strong,
.topic-warning strong,
.article-stub-state strong {
    color: #7c4a03;
    font-weight: 900;
}

.law-source-panel,
.article-source-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1.05rem;
}

.law-source-panel span,
.article-source-panel span {
    display: block;
    color: var(--mk-muted, #64748b);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.law-source-panel strong,
.article-source-panel strong {
    display: block;
    margin-top: .25rem;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.law-source-panel p,
.article-source-panel p {
    margin: .35rem 0 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.6;
    word-break: break-word;
}

.law-source-actions,
.empty-actions,
.article-source-actions,
.article-row-actions,
.article-stub-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
}

.article-filter,
.topic-filter {
    display: grid;
    gap: .75rem;
    margin-top: 1rem;
    padding: .95rem;
    border: 1px solid var(--mk-line, #e4dfd7) !important;
    border-radius: var(--mk-radius-lg, 10px) !important;
    background: #fff !important;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24,24,27,.07)) !important;
}

.article-filter {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
}

.topic-filter {
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 1rem;
}

.article-filter input,
.topic-filter input {
    min-height: 44px;
    padding: .72rem .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2) !important;
    border-radius: var(--mk-radius, 8px) !important;
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
}

.article-filter a {
    color: var(--mk-brand, #7f1d1d);
    text-decoration: none;
    font-weight: 900;
}

.article-list {
    margin-top: 1rem;
}

.article-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .75rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7) !important;
    border-radius: var(--mk-radius-lg, 10px) !important;
    background: #fff !important;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24,24,27,.07)) !important;
}

.article-row strong,
.article-row span {
    display: block;
}

.article-row strong,
.empty-box h3,
.topic-panel-head h2,
.topic-side-panel h2,
.topic-article h3,
.article-summary h2,
.paper-meta strong,
.law-message h1,
.article-message h1,
.topic-empty h1 {
    color: var(--mk-ink, #18181b);
    letter-spacing: 0;
}

.article-row span,
.empty-box p,
.topic-answer,
.topic-steps,
.topic-article p,
.topic-article em,
.source-note p,
.topic-empty-inline p,
.article-summary p,
.paper-meta span,
.inline-source-note,
.law-message p,
.article-message p,
.topic-empty p {
    color: var(--mk-muted, #64748b);
    line-height: 1.65;
}

.tier-badge,
.topic-article-meta span,
.topic-article-meta small,
.topic-term-list a {
    display: inline-flex;
    align-items: center;
    padding: .28rem .58rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 900;
    font-style: normal;
}

.tier-official_full {
    border: 1px solid #f5d0d0;
    background: #fff7f7 !important;
    color: var(--mk-brand, #7f1d1d) !important;
}

.tier-editorial_summary {
    border: 1px solid #dbeafe;
    background: #eff6ff !important;
    color: #1e40af !important;
}

.tier-stub,
.tier-empty {
    border: 1px solid #fed7aa;
    background: #fff7ed !important;
    color: #9a3412 !important;
}

.topic-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1rem;
    margin-top: 1rem;
}

.topic-main,
.topic-side,
.topic-article-list {
    display: grid;
    gap: 1rem;
}

.topic-panel,
.topic-side-panel {
    padding: 1.15rem;
}

.topic-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .8rem;
}

.topic-panel-head h2,
.topic-side-panel h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 900;
}

.topic-panel-head span {
    color: var(--mk-muted, #64748b);
    font-weight: 900;
}

.topic-answer,
.topic-steps {
    margin: 0;
}

.topic-steps {
    padding-left: 1.35rem;
    line-height: 1.85;
}

.topic-article {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
}

.topic-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
}

.topic-article-meta span {
    border: 1px solid #f5d0d0;
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
}

.topic-article-meta small {
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-muted, #64748b);
}

.topic-article-meta .primary {
    border-color: #fde68a;
    background: #fef3c7;
    color: #92400e;
}

.topic-article h3 {
    margin: .65rem 0 .35rem;
    font-size: 1.05rem;
}

.topic-article p,
.topic-article em {
    margin: 0;
}

.topic-article em {
    display: block;
    margin-top: .45rem;
}

.topic-side {
    align-content: start;
}

.topic-side-panel > a {
    margin-top: .6rem;
}

.topic-term-list {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.topic-term-list a {
    border: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-soft, #f8fafc);
    color: var(--mk-ink-soft, #334155);
    text-decoration: none;
}

.topic-empty-inline {
    padding: 1rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-soft, #f8fafc);
}

.topic-empty-inline h3 {
    margin: 0 0 .35rem;
    color: var(--mk-ink, #18181b);
}

.article-summary,
.article-paper {
    margin-top: 1rem;
    padding: 1.1rem;
}

.paper-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
}

.article-paper pre {
    margin: 0;
    white-space: pre-wrap;
    color: var(--mk-ink, #18181b);
    font: 16px/1.8 Georgia, "Times New Roman", serif;
}

.article-stub-state {
    margin-top: 0;
}

.article-stub-state p {
    margin: .2rem 0 .9rem;
    line-height: 1.7;
}

.inline-source-note {
    margin-top: 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-soft, #f8fafc);
    word-break: break-word;
}

.inline-source-note strong,
.inline-source-note a {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
}

.law-message,
.article-message,
.topic-empty {
    padding: clamp(1.25rem, 2.6vw, 2rem);
}

@media(max-width:900px) {
    .law-detail-layout,
    .topic-hero-grid,
    .article-hero-layout,
    .topic-layout {
        grid-template-columns: 1fr;
    }

    .topic-hero aside {
        text-align: left;
    }

    .law-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .law-source-panel,
    .article-source-panel,
    .article-row,
    .topic-article,
    .paper-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media(max-width:640px) {
    .law-detail-page,
    .topic-page,
    .article-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding: 1rem 0 2rem !important;
    }

    .law-meta,
    .article-filter,
    .topic-filter {
        grid-template-columns: 1fr;
    }

    .law-source-actions,
    .empty-actions,
    .article-source-actions,
    .article-row-actions,
    .article-stub-actions {
        width: 100%;
    }

    .law-source-actions a,
    .empty-actions a,
    .article-source-actions a,
    .article-row-actions a,
    .article-stub-actions a,
    .topic-article > a,
    .topic-filter button {
        width: 100%;
        text-align: center;
    }

    .topic-panel-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Phase 8: documents archive unified layout */
.documents-page-container {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
    font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif) !important;
}

.documents-page-container .documents-hero {
    position: relative;
    margin: 0 0 1rem !important;
    padding: clamp(1.25rem, 2.6vw, 2rem) !important;
    overflow: hidden;
}

.documents-page-container .hero-bg-pattern {
    display: none !important;
}

.documents-page-container .hero-content {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 1rem;
    align-items: center;
}

.documents-page-container .hero-title {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 !important;
    color: #fff !important;
    font-size: clamp(2rem, 3.2vw, 2.7rem) !important;
    line-height: 1.08 !important;
    letter-spacing: 0 !important;
}

.documents-page-container .hero-subtitle {
    margin: .45rem 0 0 !important;
    color: rgba(255, 255, 255, .76) !important;
    font-size: .98rem !important;
}

.documents-page-container .hero-stats-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .65rem;
}

.documents-page-container .hero-stat-card {
    min-width: 116px;
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .72rem .82rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .09);
    box-shadow: none;
}

.documents-page-container .hero-stat-card.highlight {
    border-color: rgba(255, 255, 255, .22);
    background: rgba(127, 29, 29, .32);
}

.documents-page-container .hero-stat-card .stat-icon {
    flex: 0 0 auto;
    color: rgba(255, 255, 255, .86);
    font-size: 1.1rem;
}

.documents-page-container .hero-stat-card .stat-value {
    color: #fff;
    font-size: 1.18rem;
    font-weight: 900;
    line-height: 1;
}

.documents-page-container .hero-stat-card .stat-label {
    margin-top: .15rem;
    color: rgba(255, 255, 255, .66);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: 0;
}

.documents-page-container .btn-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: .72rem 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: none;
}

.documents-page-container .btn-upload:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

.documents-page-container .documents-search-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    margin: 0 0 1rem !important;
    padding: 1rem !important;
}

.documents-page-container .documents-search-input {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 44px;
    padding: 0 .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.documents-page-container .documents-search-input svg {
    flex: 0 0 auto;
    color: var(--mk-muted, #64748b);
}

.documents-page-container .documents-search-input input {
    width: 100%;
    min-width: 0;
    border: 0 !important;
    background: transparent;
    box-shadow: none !important;
    font: inherit;
}

.documents-page-container .documents-search-panel button {
    min-height: 44px;
    padding: 0 1rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-weight: 900;
    letter-spacing: 0;
    cursor: pointer;
    white-space: nowrap;
}

.documents-page-container .documents-search-panel button:hover {
    background: var(--mk-brand-strong, #5f1515);
}

.documents-page-container .popular-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0 0 1rem !important;
    padding: 1rem !important;
}

.documents-page-container .popular-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .38rem .72rem;
    border: 1px solid #f5d0d0;
    border-radius: 999px;
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 900;
    white-space: nowrap;
}

.documents-page-container .popular-title {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 900;
}

.documents-page-container .download-count {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-top: .22rem;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
    font-weight: 700;
}

.documents-page-container .categories-wrapper {
    display: grid;
    gap: 1rem;
}

.documents-page-container .category-section {
    overflow: hidden;
    border-radius: var(--mk-radius-lg, 10px) !important;
}

.documents-page-container .category-header-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: #fff7f7;
    color: var(--mk-ink, #18181b);
}

.documents-page-container .category-header-link {
    text-decoration: none;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.documents-page-container .category-header-link:hover {
    box-shadow: 0 14px 28px rgba(24, 24, 27, .08);
    transform: translateY(-1px);
}

.documents-page-container .category-icon-badge {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    box-shadow: inset 0 0 0 1px #f5d0d0;
}

.documents-page-container .category-header-content {
    min-width: 0;
    flex: 1 1 auto;
}

.documents-page-container .category-title {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.08rem;
    font-weight: 900;
}

.documents-page-container .category-description {
    margin: .28rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .86rem;
    line-height: 1.5;
}

.documents-page-container .category-count-badge {
    flex: 0 0 auto;
    padding: .38rem .72rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 900;
}

.documents-page-container .no-subcategories-card,
.documents-page-container .empty-state {
    padding: 1.25rem;
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.documents-page-container .subcategories-container {
    display: grid;
}

.documents-page-container .document-category-card {
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    transition: background .18s ease, transform .18s ease;
}

.documents-page-container .document-category-card:last-child {
    border-bottom: 0;
}

.documents-page-container .document-category-card:hover {
    background: #fbfaf8;
}

.documents-page-container .category-card-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px minmax(220px, 300px);
    gap: 1rem;
    align-items: center;
    min-height: 86px;
    padding: 1rem 1.1rem;
    color: inherit;
    text-decoration: none;
}

.documents-page-container .card-header {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.documents-page-container .folder-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
}

.documents-page-container .category-name {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.25;
}

.documents-page-container .category-desc {
    margin: .28rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
    line-height: 1.45;
}

.documents-page-container .document-count-section {
    display: flex;
    justify-content: center;
}

.documents-page-container .count-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .42rem .66rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
    white-space: nowrap;
}

.documents-page-container .count-number {
    color: var(--mk-brand, #7f1d1d);
    font-size: 1rem;
}

.documents-page-container .count-label {
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    letter-spacing: 0;
}

.documents-page-container .last-document-section,
.documents-page-container .no-documents-section {
    min-width: 0;
    padding-left: 1rem;
    border-left: 1px solid var(--mk-line, #e4dfd7);
}

.documents-page-container .last-doc-header {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-bottom: .22rem;
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    font-weight: 900;
}

.documents-page-container .last-doc-title {
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-size: .88rem;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.documents-page-container .last-doc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-top: .25rem;
    color: var(--mk-muted, #64748b);
    font-size: .76rem;
}

.documents-page-container .doc-uploader {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
}

.documents-page-container .doc-uploader:hover {
    text-decoration: underline;
}

.documents-page-container .no-documents-section {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
}

@media(max-width: 1024px) {
    .documents-page-container .hero-content {
        grid-template-columns: 1fr;
    }

    .documents-page-container .hero-stats-grid {
        justify-content: flex-start;
    }

    .documents-page-container .category-card-link {
        grid-template-columns: minmax(0, 1fr) 120px;
    }

    .documents-page-container .last-document-section,
    .documents-page-container .no-documents-section {
        grid-column: 1 / -1;
        padding: .85rem 0 0;
        border-left: 0;
        border-top: 1px solid var(--mk-line, #e4dfd7);
    }
}

@media(max-width: 700px) {
    .documents-page-container {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .documents-page-container .documents-search-panel {
        grid-template-columns: 1fr;
    }

    .documents-page-container .documents-search-panel button {
        width: 100%;
    }

    .documents-page-container .popular-banner,
    .documents-page-container .category-header-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .documents-page-container .category-card-link {
        grid-template-columns: 1fr;
    }

    .documents-page-container .document-count-section {
        justify-content: flex-start;
    }
}

/* Phase 9: document category listing unified layout */
.document-category-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
}

.document-category-page .forum-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    margin: 0 0 1rem;
    padding: .78rem .95rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.document-category-page .forum-breadcrumb a {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
}

.document-category-page .category-header-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.document-category-page .category-info {
    min-width: 0;
}

.document-category-page .category-info h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    line-height: 1.08;
    font-weight: 900;
    letter-spacing: 0;
}

.document-category-page .category-info .category-desc {
    margin: .55rem 0 0;
    color: rgba(255, 255, 255, .76);
    font-size: .98rem;
    line-height: 1.6;
}

.document-category-page .category-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: .85rem;
}

.document-category-page .category-stats span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .42rem .68rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .09);
    color: rgba(255, 255, 255, .86);
    font-size: .82rem;
    font-weight: 900;
}

.document-category-page .btn-upload,
.document-category-page .btn-primary,
.document-category-page .document-category-search-clear,
.document-category-page .btn-download,
.document-category-page .top-documents-head > a,
.document-category-page .page-btn {
    border-radius: var(--mk-radius, 8px) !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
}

.document-category-page .btn-upload {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: .72rem 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    white-space: nowrap;
}

.document-category-page .document-category-search-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: .7rem;
    align-items: center;
    margin: 0 0 1rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.document-category-page .document-subcategory-gateway {
    margin: 0 0 1rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.document-category-page .document-subcategory-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .9rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
}

.document-category-page .document-subcategory-kicker {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 900;
}

.document-category-page .document-subcategory-head h2 {
    margin: .25rem 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.25rem;
    font-weight: 900;
}

.document-category-page .document-subcategory-head p {
    margin: 0;
    color: var(--mk-muted, #64748b);
}

.document-category-page .document-subcategory-total {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 .75rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
    font-size: .82rem;
    font-weight: 900;
    white-space: nowrap;
}

.document-category-page .document-subcategory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.document-category-page .document-subcategory-card {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: .7rem;
    align-items: center;
    padding: .95rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: inherit;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.document-category-page .document-subcategory-card:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 14px 28px rgba(24, 24, 27, .08);
    transform: translateY(-1px);
}

.document-category-page .document-subcategory-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
    color: var(--mk-brand, #7f1d1d);
}

.document-category-page .document-subcategory-body {
    min-width: 0;
}

.document-category-page .document-subcategory-body strong,
.document-category-page .document-subcategory-body small {
    display: block;
}

.document-category-page .document-subcategory-body strong {
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-category-page .document-subcategory-body small,
.document-category-page .document-subcategory-last {
    color: var(--mk-muted, #64748b);
    font-size: .8rem;
    line-height: 1.45;
}

.document-category-page .document-subcategory-meta {
    min-width: 78px;
    padding: .45rem .6rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    text-align: center;
}

.document-category-page .document-subcategory-meta b,
.document-category-page .document-subcategory-meta small {
    display: block;
}

.document-category-page .document-subcategory-meta b {
    color: var(--mk-brand, #7f1d1d);
    font-size: 1rem;
    font-weight: 900;
}

.document-category-page .document-subcategory-meta small {
    color: var(--mk-muted, #64748b);
    font-size: .68rem;
    font-weight: 850;
}

.document-category-page .document-subcategory-last {
    grid-column: 2 / -1;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-category-page .document-category-search-field {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 44px;
    padding: 0 .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.document-category-page .document-category-search-field input {
    width: 100%;
    min-width: 0;
    border: 0 !important;
    background: transparent;
    box-shadow: none !important;
    font: inherit;
}

.document-category-page .document-category-search-box button,
.document-category-page .btn-primary,
.document-category-page .btn-download {
    min-height: 42px;
    padding: 0 .95rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    cursor: pointer;
}

.document-category-page .document-category-search-box button:hover,
.document-category-page .btn-primary:hover,
.document-category-page .btn-download:hover {
    background: var(--mk-brand-strong, #5f1515);
}

.document-category-page .document-category-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
}

.document-category-page .document-category-search-summary {
    margin: 0 0 1rem;
    padding: .9rem 1rem;
    border: 1px solid #dbeafe;
    border-radius: var(--mk-radius, 8px);
    background: #eff6ff;
    color: #1e40af;
    font-weight: 800;
}

.document-category-page .top-documents-showcase,
.document-category-page .empty-state,
.document-category-page .documents-list,
.document-category-page .pagination {
    margin-top: 1rem;
}

.document-category-page .top-documents-showcase {
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.document-category-page .top-documents-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .9rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
}

.document-category-page .top-documents-kicker {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 900;
}

.document-category-page .top-documents-head h2 {
    margin: .25rem 0 .25rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.25rem;
    font-weight: 900;
}

.document-category-page .top-documents-head p {
    margin: 0;
    color: var(--mk-muted, #64748b);
}

.document-category-page .top-documents-head > a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 .85rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
    white-space: nowrap;
}

.document-category-page .top-documents-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}

.document-category-page .top-document-card {
    min-width: 0;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: .55rem;
    align-items: center;
    padding: .85rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: inherit;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.document-category-page .top-document-card:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 14px 28px rgba(24, 24, 27, .08);
    transform: translateY(-1px);
}

.document-category-page .top-document-rank {
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 900;
}

.document-category-page .top-document-body {
    min-width: 0;
}

.document-category-page .top-document-body strong {
    display: block;
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-size: .9rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-category-page .top-document-body small {
    display: block;
    margin-top: .2rem;
    color: var(--mk-muted, #64748b);
    font-size: .76rem;
}

.document-category-page .empty-state {
    padding: 2rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.document-category-page .empty-state h2 {
    margin: 0 0 .5rem;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.document-category-page .documents-list {
    display: grid;
    gap: .85rem;
}

.document-category-page .document-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.document-category-page .document-card:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 16px 34px rgba(24, 24, 27, .10);
    transform: translateY(-1px);
}

.document-category-page .document-card.is-pinned {
    border-color: #f5d0d0;
    background: #fffafa;
}

.document-category-page .doc-pinned-badge {
    position: absolute;
    top: .75rem;
    right: .75rem;
    padding: .26rem .55rem;
    border-radius: 999px;
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
    font-size: .72rem;
    font-weight: 900;
}

.document-category-page .doc-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
    font-size: 1.35rem;
}

.document-category-page .doc-info {
    min-width: 0;
}

.document-category-page .doc-info h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
}

.document-category-page .doc-info h3 a {
    color: var(--mk-ink, #18181b);
    text-decoration: none;
}

.document-category-page .doc-info h3 a:hover {
    color: var(--mk-brand, #7f1d1d);
}

.document-category-page .doc-description {
    margin: .4rem 0 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.document-category-page .doc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: .65rem;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
}

.document-category-page .doc-author {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
}

.document-category-page .doc-date,
.document-category-page .doc-size {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
}

.document-category-page .doc-stats {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.document-category-page .doc-stats .stat {
    min-width: 78px;
    padding: .55rem .7rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    text-align: center;
}

.document-category-page .stat-num {
    display: block;
    color: var(--mk-brand, #7f1d1d);
    font-size: 1rem;
    font-weight: 900;
}

.document-category-page .stat-label {
    display: block;
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    font-weight: 800;
}

.document-category-page .btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .38rem;
    white-space: nowrap;
}

.document-category-page .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem;
}

.document-category-page .page-btn,
.document-category-page .page-dots {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .75rem;
}

.document-category-page .page-btn {
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.document-category-page .page-btn.active,
.document-category-page .page-btn:hover {
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.document-category-page .page-dots {
    color: var(--mk-muted, #64748b);
    font-weight: 900;
}

@media(max-width: 1180px) {
    .document-category-page .top-documents-grid,
    .document-category-page .document-subcategory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media(max-width: 860px) {
    .document-category-page .category-header-box,
    .document-category-page .top-documents-head,
    .document-category-page .document-subcategory-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .document-category-page .document-category-search-box {
        grid-template-columns: 1fr;
    }

    .document-category-page .document-category-search-box button,
    .document-category-page .document-category-search-clear,
    .document-category-page .btn-upload {
        width: 100%;
    }

    .document-category-page .document-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .document-category-page .doc-stats {
        grid-column: 1 / -1;
        justify-content: space-between;
        padding-top: .85rem;
        border-top: 1px solid var(--mk-line, #e4dfd7);
    }
}

@media(max-width: 640px) {
    .document-category-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .document-category-page .top-documents-grid,
    .document-category-page .document-subcategory-grid {
        grid-template-columns: 1fr;
    }

    .document-category-page .document-subcategory-card {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .document-category-page .document-subcategory-meta {
        grid-column: 2 / -1;
        justify-self: start;
    }

    .document-category-page .document-subcategory-last {
        grid-column: 1 / -1;
        white-space: normal;
    }

    .document-category-page .document-card {
        grid-template-columns: 1fr;
    }

    .document-category-page .doc-icon {
        width: 44px;
        height: 44px;
    }

    .document-category-page .doc-stats {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Notification delete actions */
.notifications-hero {
    flex-wrap: wrap;
    gap: 1rem;
}

.notifications-delete-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .7rem 1rem;
    border: 1px solid rgba(185, 28, 28, .28);
    border-radius: 10px;
    background: #fff7f7;
    color: #991b1b;
    font-weight: 900;
    cursor: pointer;
}

.notifications-delete-all-btn:hover {
    background: #fee2e2;
}

/* Phase 10: document detail unified layout */
.document-view-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
}

.document-view-page .forum-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    margin: 0 0 1rem;
    padding: .78rem .95rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.document-view-page .forum-breadcrumb a {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
}

.document-view-page .document-view {
    display: grid;
    gap: 1rem;
}

.document-view-page .doc-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.document-view-page .doc-icon-large {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
    font-size: 1.7rem;
}

.document-view-page .doc-title-section {
    min-width: 0;
}

.document-view-page .doc-title-section h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: 0;
}

.document-view-page .doc-category {
    margin-top: .65rem;
}

.document-view-page .doc-category a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .42rem .68rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .09);
    color: rgba(255, 255, 255, .86);
    font-size: .82rem;
    font-weight: 900;
    text-decoration: none;
}

.document-view-page .doc-content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: start;
}

.document-view-page .doc-info-card,
.document-view-page .uploader-card {
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.document-view-page .doc-info-card h3,
.document-view-page .uploader-card-title {
    margin: 0 0 .85rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.1rem;
    font-weight: 900;
}

.document-view-page .info-section {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
}

.document-view-page .info-section h4 {
    margin: 0 0 .4rem;
    color: var(--mk-ink-soft, #334155);
    font-size: .92rem;
    font-weight: 900;
}

.document-view-page .info-section p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.7;
}

.document-view-page .info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.document-view-page .info-item {
    min-width: 0;
    padding: .85rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
}

.document-view-page .info-label,
.document-view-page .info-value {
    display: block;
}

.document-view-page .info-label {
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 900;
}

.document-view-page .info-value {
    margin-top: .25rem;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.document-view-page .error-alert {
    margin: 1rem 0 0;
    padding: .85rem 1rem;
    border: 1px solid #fecaca;
    border-radius: var(--mk-radius, 8px);
    background: #fef2f2;
    color: #991b1b;
    font-weight: 800;
}

.document-view-page .document-actions {
    margin-top: 1rem;
}

.document-view-page .btn-download-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 46px;
    padding: 0 1.1rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-weight: 900;
    text-decoration: none;
}

.document-view-page .btn-download-large:hover {
    background: var(--mk-brand-strong, #5f1515);
}

.document-view-page .btn-download-large.is-disabled {
    cursor: not-allowed;
    opacity: .58;
    filter: grayscale(.25);
}

.document-view-page .document-download-quota {
    display: block;
    margin-top: 10px;
    color: var(--mk-text-muted, #64748b);
    font-size: .84rem;
    font-weight: 700;
}

.cetele-page-container .cetele-quota-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 12px;
    color: rgba(255, 255, 255, .78);
    font-size: .82rem;
    font-weight: 700;
}

.cetele-page-container .btn-hero-primary.is-disabled {
    cursor: not-allowed;
    opacity: .62;
}

.document-view-page .uploader-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.document-view-page .uploader-avatar-ring {
    width: 100px;
    height: 100px;
    overflow: hidden;
    border: 3px solid var(--mk-brand, #7f1d1d);
    border-radius: 50%;
    background: var(--mk-surface-muted, #f8fafc);
}

.document-view-page .uploader-avatar-image,
.document-view-page .uploader-avatar-fallback {
    width: 100%;
    height: 100%;
}

.document-view-page .uploader-avatar-image {
    display: block;
    object-fit: cover;
}

.document-view-page .uploader-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-size: 2.2rem;
    font-weight: 900;
}

.document-view-page .uploader-name {
    color: var(--mk-brand, #7f1d1d);
    font-size: 1.12rem;
    font-weight: 900;
    text-align: center;
    text-decoration: none;
}

.document-view-page .uploader-badge-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
}

.document-view-page .uploader-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .9rem;
    border: 2px solid color-mix(in srgb, var(--rank-color, var(--mk-brand, #7f1d1d)) 42%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--rank-color, var(--mk-brand, #7f1d1d)) 12%, white);
    box-shadow: none;
}

.document-view-page .uploader-badge-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.document-view-page .uploader-badge-title {
    color: var(--rank-color, var(--mk-ink, #18181b));
    font-size: .88rem;
    font-weight: 900;
    letter-spacing: 0;
    white-space: nowrap;
}

.document-view-page .tags-section {
    width: 100%;
    margin-top: .25rem;
}

.document-view-page .tags-title {
    margin: 0 0 .55rem;
    color: var(--mk-muted, #64748b);
    font-size: .92rem;
    font-weight: 900;
    text-align: center;
}

.document-view-page .tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
}

.document-view-page .tag {
    display: inline-flex;
    align-items: center;
    padding: .38rem .72rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
    font-size: .82rem;
    font-weight: 800;
}

@media(max-width: 900px) {
    .document-view-page .doc-content-grid {
        grid-template-columns: 1fr;
    }
}

@media(max-width: 640px) {
    .document-view-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .document-view-page .doc-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .document-view-page .info-grid {
        grid-template-columns: 1fr;
    }

    .document-view-page .btn-download-large {
        width: 100%;
    }
}

/* Phase 11: forum home unified layout */
.classic-forum-wrapper {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
    font-family: var(--font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif) !important;
}

.classic-forum-wrapper .forum-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem !important;
    padding: clamp(1.25rem, 2.6vw, 2rem) !important;
    border: 1px solid rgba(255, 255, 255, .09) !important;
    border-radius: var(--mk-radius-lg, 10px) !important;
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%) !important;
    color: #fff !important;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15)) !important;
}

.classic-forum-wrapper .topbar-left {
    min-width: 0;
    display: grid;
    gap: .35rem;
}

.classic-forum-wrapper .forum-title {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0 !important;
    color: #fff !important;
    font-size: clamp(2rem, 3.2vw, 2.7rem) !important;
    font-weight: 900 !important;
    line-height: 1.08 !important;
    letter-spacing: 0 !important;
}

.classic-forum-wrapper .forum-subtitle {
    margin: 0 !important;
    padding: 0 !important;
    color: rgba(255, 255, 255, .76) !important;
    font-size: .98rem !important;
}

.classic-forum-wrapper .forum-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .65rem;
}

.classic-forum-wrapper .forum-topbar-inline-form {
    margin: 0;
}

.classic-forum-wrapper .btn-watched-topics {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: .72rem 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.classic-forum-wrapper .btn-watched-topics:hover {
    background: rgba(255, 255, 255, .16);
    transform: translateY(-1px);
}

.classic-forum-wrapper .btn-new-topic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: .72rem 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: none;
}

.classic-forum-wrapper .btn-new-topic:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

.classic-forum-wrapper .forum-search-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    margin: 0 0 1rem !important;
    padding: 1rem !important;
    border: 1px solid var(--mk-line, #e4dfd7) !important;
    border-radius: var(--mk-radius-lg, 10px) !important;
    background: #fff !important;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07)) !important;
}

.classic-forum-wrapper .forum-search-input {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 44px;
    padding: 0 .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.classic-forum-wrapper .forum-search-input svg {
    flex: 0 0 auto;
    color: var(--mk-muted, #64748b);
}

.classic-forum-wrapper .forum-search-input input {
    width: 100%;
    min-width: 0;
    border: 0 !important;
    background: transparent;
    box-shadow: none !important;
    font: inherit;
}

.classic-forum-wrapper .forum-search-panel button {
    min-height: 44px;
    padding: 0 1rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-weight: 900;
    letter-spacing: 0;
    cursor: pointer;
    white-space: nowrap;
}

.classic-forum-wrapper .forum-search-panel button:hover {
    background: var(--mk-brand-strong, #5f1515);
}

.classic-forum-wrapper .forum-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
    margin: 0 0 1rem !important;
}

.classic-forum-wrapper .stat-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    padding: .9rem 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.classic-forum-wrapper .stat-item:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 16px 34px rgba(24, 24, 27, .10);
    transform: translateY(-1px);
}

.classic-forum-wrapper .stat-ico {
    flex: 0 0 auto;
    color: var(--mk-brand, #7f1d1d);
    font-size: 1.1rem;
}

.classic-forum-wrapper .stat-num {
    color: var(--mk-ink, #18181b);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
}

.classic-forum-wrapper .stat-lbl {
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 800;
}

.classic-forum-wrapper .stat-online .stat-num {
    color: var(--mk-accent, #166534);
}

.classic-forum-wrapper .welcome-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin: 0 0 1rem !important;
    padding: .9rem 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    font-size: .92rem;
}

.classic-forum-wrapper .welcome-username {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
}

.classic-forum-wrapper .welcome-time {
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
}

.classic-forum-wrapper .category-section {
    overflow: hidden;
    margin: 0 0 1rem !important;
    border: 1px solid var(--mk-line, #e4dfd7) !important;
    border-radius: var(--mk-radius-lg, 10px) !important;
    background: #fff !important;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07)) !important;
}

.classic-forum-wrapper .cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: #fff7f7;
    color: var(--mk-ink, #18181b);
}

.classic-forum-wrapper .cat-header-link {
    text-decoration: none !important;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease;
}

.classic-forum-wrapper .cat-header-link:hover {
    background: #fff1f1;
}

.classic-forum-wrapper .cat-header-link:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: -3px;
}

.classic-forum-wrapper .cat-header-left {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .75rem;
}

.classic-forum-wrapper .cat-icon-big {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    box-shadow: inset 0 0 0 1px #f5d0d0;
}

.classic-forum-wrapper .cat-title-area {
    min-width: 0;
}

.classic-forum-wrapper .cat-name {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.08rem;
    font-weight: 900;
}

.classic-forum-wrapper .cat-desc {
    margin: .28rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .86rem;
    line-height: 1.5;
}

.classic-forum-wrapper .cat-badge {
    flex: 0 0 auto;
    padding: .38rem .72rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 900;
}

.classic-forum-wrapper .subcat-list {
    display: grid;
}

.classic-forum-wrapper .subcat-row {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) 180px minmax(220px, 270px);
    gap: 1rem;
    align-items: center;
    min-height: 88px;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    transition: background .18s ease;
}

.classic-forum-wrapper .subcat-row:last-child {
    border-bottom: 0;
}

.classic-forum-wrapper .subcat-row:hover {
    background: #fbfaf8;
}

.classic-forum-wrapper .subcat-link-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.classic-forum-wrapper .subcat-row .meta-author,
.classic-forum-wrapper .subcat-row a:not(.subcat-link-overlay) {
    position: relative;
    z-index: 2;
}

.classic-forum-wrapper .subcat-icon-col {
    display: flex;
    align-items: center;
    justify-content: center;
}

.classic-forum-wrapper .subcat-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
}

.classic-forum-wrapper .subcat-info-col {
    min-width: 0;
}

.classic-forum-wrapper .subcat-title {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.25;
}

.classic-forum-wrapper .forum-unread-pill,
.forum-category-page .forum-unread-pill {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    min-height: 24px;
    margin-left: .45rem;
    padding: .2rem .52rem;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fff1f2;
    color: #b91c1c;
    font-size: .72rem;
    font-weight: 950;
    white-space: nowrap;
    vertical-align: middle;
}

.classic-forum-wrapper .subcat-desc {
    margin: .28rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
    line-height: 1.45;
}

.classic-forum-wrapper .subcat-stats-col {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .8rem;
}

.classic-forum-wrapper .stat-box {
    display: flex;
    align-items: center;
    gap: .42rem;
}

.classic-forum-wrapper .stat-data {
    display: grid;
    gap: .08rem;
}

.classic-forum-wrapper .stat-val {
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

.classic-forum-wrapper .stat-lab {
    color: var(--mk-muted, #64748b);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: 0;
}

.classic-forum-wrapper .stat-sep {
    width: 1px;
    height: 30px;
    background: var(--mk-line, #e4dfd7);
}

.classic-forum-wrapper .subcat-activity-col {
    min-width: 0;
    padding-left: 1rem;
    border-left: 1px solid var(--mk-line, #e4dfd7);
}

.classic-forum-wrapper .last-post-box {
    min-width: 0;
    display: grid;
    gap: .25rem;
}

.classic-forum-wrapper .last-post-title {
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-size: .88rem;
    font-weight: 800;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.classic-forum-wrapper .last-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    color: var(--mk-muted, #64748b);
    font-size: .76rem;
}

.classic-forum-wrapper .meta-author {
    color: var(--forum-author-color, var(--mk-brand, #7f1d1d));
    font-weight: 900;
    text-decoration: none;
}

.classic-forum-wrapper .meta-author:hover {
    text-decoration: underline;
}

.classic-forum-wrapper .meta-dot {
    color: var(--mk-line-strong, #d6cec2);
}

.classic-forum-wrapper .no-posts-box,
.classic-forum-wrapper .no-subs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
}

.classic-forum-wrapper .no-subs {
    padding: 1.25rem;
}

.classic-forum-wrapper .empty-msg {
    padding: 2rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    text-align: center;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.classic-forum-wrapper .empty-msg h2 {
    margin: .5rem 0;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.classic-forum-wrapper .empty-msg p {
    margin: 0;
    color: var(--mk-muted, #64748b);
}

@media(max-width: 1040px) {
    .classic-forum-wrapper .forum-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .classic-forum-wrapper .forum-topbar-actions,
    .classic-forum-wrapper .btn-watched-topics,
    .classic-forum-wrapper .forum-topbar-inline-form,
    .classic-forum-wrapper .forum-topbar-inline-form button,
    .classic-forum-wrapper .btn-new-topic {
        width: 100%;
    }

    .classic-forum-wrapper .subcat-row {
        grid-template-columns: 48px minmax(0, 1fr) 150px;
    }

    .classic-forum-wrapper .subcat-activity-col {
        grid-column: 2 / -1;
        padding: .85rem 0 0;
        border-top: 1px solid var(--mk-line, #e4dfd7);
        border-left: 0;
    }
}

@media(max-width: 760px) {
    .classic-forum-wrapper {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .classic-forum-wrapper .forum-search-panel {
        grid-template-columns: 1fr;
    }

    .classic-forum-wrapper .forum-search-panel button,
    .classic-forum-wrapper .btn-new-topic {
        width: 100%;
    }

    .classic-forum-wrapper .forum-stats-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .classic-forum-wrapper .cat-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .classic-forum-wrapper .subcat-row {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .classic-forum-wrapper .subcat-stats-col,
    .classic-forum-wrapper .subcat-activity-col {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding: .8rem 0 0;
        border-left: 0;
        border-top: 1px solid var(--mk-line, #e4dfd7);
    }
}

@media(max-width: 460px) {
    .classic-forum-wrapper .forum-stats-bar {
        grid-template-columns: 1fr;
    }
}

/* Phase 12: forum category topic listing */
.forum-category-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
}

.forum-category-page .forum-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    margin: 0 0 1rem;
    padding: .78rem .95rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-category-page .forum-breadcrumb a {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
}

.forum-category-page .category-header-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.forum-category-page .category-info {
    min-width: 0;
}

.forum-category-page .category-info h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: 0;
}

.forum-category-page .category-info .category-desc {
    margin: .55rem 0 0;
    color: rgba(255, 255, 255, .76);
    font-size: .98rem;
    line-height: 1.6;
}

.forum-category-page .category-stats {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: .85rem;
}

.forum-category-page .category-stats span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .42rem .68rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .09);
    color: rgba(255, 255, 255, .86);
    font-size: .82rem;
    font-weight: 900;
}

.forum-category-page .btn-new-topic,
.forum-category-page .btn-primary,
.forum-category-page .category-search-clear,
.forum-category-page .page-btn {
    border-radius: var(--mk-radius, 8px) !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
}

.forum-category-page .btn-new-topic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: .72rem 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    white-space: nowrap;
}

.forum-category-page .forum-subcategory-gateway {
    overflow: hidden;
    margin: 0 0 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-category-page .forum-subcategory-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: #fff7f7;
}

.forum-category-page .forum-subcategory-kicker {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 900;
}

.forum-category-page .forum-subcategory-head h2 {
    margin: .32rem 0 .28rem;
    color: var(--mk-ink, #18181b);
    font-size: clamp(1.25rem, 2vw, 1.7rem);
    font-weight: 900;
    line-height: 1.16;
}

.forum-category-page .forum-subcategory-head p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.forum-category-page .forum-subcategory-total {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: .36rem .7rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 900;
}

.forum-category-page .forum-subcategory-grid {
    display: grid;
}

.forum-category-page .forum-subcategory-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 72px 72px 34px;
    gap: .9rem;
    align-items: center;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    color: var(--mk-ink, #18181b);
    text-decoration: none !important;
    transition: background .18s ease;
}

.forum-category-page .forum-subcategory-card:last-child {
    border-bottom: 0;
}

.forum-category-page .forum-subcategory-card:hover {
    background: #fbfaf8;
}

.forum-category-page .forum-subcategory-icon,
.forum-category-page .forum-subcategory-go {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
}

.forum-category-page .forum-subcategory-body {
    min-width: 0;
    display: grid;
    gap: .2rem;
}

.forum-category-page .forum-subcategory-body strong {
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-category-page .forum-subcategory-body small,
.forum-category-page .forum-subcategory-last {
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    line-height: 1.45;
}

.forum-category-page .forum-subcategory-meta {
    display: grid;
    justify-items: center;
    gap: .1rem;
    padding: .48rem .5rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
}

.forum-category-page .forum-subcategory-meta b {
    color: var(--mk-brand, #7f1d1d);
    font-size: 1rem;
    line-height: 1;
}

.forum-category-page .forum-subcategory-meta small {
    color: var(--mk-muted, #64748b);
    font-size: .7rem;
    font-weight: 800;
}

.forum-category-page .forum-subcategory-last {
    grid-column: 2 / -1;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-width: 0;
}

.forum-category-page .category-search-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: .7rem;
    align-items: center;
    margin: 0 0 1rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-category-page .category-search-field {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 44px;
    padding: 0 .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.forum-category-page .category-search-field input {
    width: 100%;
    min-width: 0;
    border: 0 !important;
    background: transparent;
    box-shadow: none !important;
    font: inherit;
}

.forum-category-page .category-search-box button,
.forum-category-page .btn-primary {
    min-height: 42px;
    padding: 0 .95rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.forum-category-page .category-search-box button:hover,
.forum-category-page .btn-primary:hover {
    background: var(--mk-brand-strong, #5f1515);
}

.forum-category-page .category-search-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
}

.forum-category-page .category-search-summary {
    margin: 0 0 1rem;
    padding: .9rem 1rem;
    border: 1px solid #dbeafe;
    border-radius: var(--mk-radius, 8px);
    background: #eff6ff;
    color: #1e40af;
    font-weight: 800;
}

.forum-category-page .forum-topic-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    margin: 0 0 1rem;
    padding: .8rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-category-page .forum-topic-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.forum-category-page .forum-topic-filter-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: .42rem .78rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: .86rem;
    font-weight: 900;
    text-decoration: none;
}

.forum-category-page .forum-topic-filter-tabs a:hover {
    border-color: rgba(127, 29, 29, .28);
    color: var(--mk-brand, #7f1d1d);
}

.forum-category-page .forum-topic-filter-tabs a.is-active {
    border-color: rgba(127, 29, 29, .22);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.forum-category-page .forum-topic-sort-form {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    flex: 0 0 auto;
}

.forum-category-page .forum-topic-sort-form label {
    color: #64748b;
    font-size: .82rem;
    font-weight: 900;
}

.forum-category-page .forum-topic-sort-form select {
    min-height: 38px;
    padding: 0 2rem 0 .75rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background-color: #f8fafc;
    color: #0f172a;
    font-weight: 900;
}

.forum-category-page .empty-state {
    margin-top: 1rem;
    padding: 2rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    text-align: center;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-category-page .empty-state h2 {
    margin: 0 0 .5rem;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.forum-category-page .topics-list {
    display: grid;
    gap: .85rem;
}

.forum-category-page .topic-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.forum-category-page .topic-card:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 16px 34px rgba(24, 24, 27, .10);
    transform: translateY(-1px);
}

.forum-category-page .topic-card.is-unread {
    border-color: #bfdbfe;
    background: linear-gradient(90deg, #eff6ff 0, #fff 22%);
    box-shadow: 0 18px 38px rgba(37, 99, 235, .11);
}

.forum-category-page .topic-card.is-unread::before {
    content: "";
    position: absolute;
    inset: 12px auto 12px 0;
    width: 4px;
    border-radius: 999px;
    background: #2563eb;
}

.forum-category-page .topic-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
}

.forum-category-page .topic-info {
    min-width: 0;
}

.forum-category-page .topic-info h3 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.35;
}

.forum-category-page .topic-info h3 a {
    color: var(--mk-ink, #18181b);
    text-decoration: none;
}

.forum-category-page .topic-info h3 a:hover {
    color: var(--mk-brand, #7f1d1d);
}

.forum-category-page .badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-right: .45rem;
    padding: .26rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 900;
    vertical-align: middle;
}

.forum-category-page .badge-pinned {
    border: 1px solid #fbbf24;
    background: #fffbeb;
    color: #92400e;
}

.forum-category-page .badge-locked {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.forum-category-page .topic-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    margin-top: .65rem;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
}

.forum-category-page .topic-author {
    color: var(--topic-author-color, var(--mk-brand, #7f1d1d));
    font-weight: 900;
    text-decoration: none;
}

.forum-category-page .topic-author:hover {
    text-decoration: underline;
}

.forum-category-page .topic-time {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
}

.forum-category-page .topic-last-reply {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 28px;
    padding: .24rem .58rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-weight: 850;
}

.forum-category-page .topic-last-reply a {
    color: #0f172a;
    font-weight: 950;
    text-decoration: none;
}

.forum-category-page .topic-last-reply a:hover {
    color: var(--mk-brand, #7f1d1d);
}

.forum-category-page .topic-last-reply small {
    color: #94a3b8;
    font-size: .76rem;
    font-weight: 850;
}

.forum-category-page .topic-last-reply.no-last-reply {
    border-color: #f1f5f9;
    background: #fff;
    color: #94a3b8;
}

.forum-category-page .topic-unread-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 28px;
    padding: .24rem .6rem;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 900;
    text-decoration: none;
}

.forum-category-page .topic-unread-link:hover {
    background: #dbeafe;
    color: #1e40af;
}

.forum-category-page .topic-stats {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.forum-category-page .topic-stats .stat {
    min-width: 86px;
    padding: .55rem .7rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    text-align: center;
}

.forum-category-page .stat-num {
    display: block;
    color: var(--mk-brand, #7f1d1d);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

.forum-category-page .stat-label {
    display: block;
    margin-top: .2rem;
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: 0;
}

.forum-category-page .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem;
    margin-top: 1rem;
}

.forum-category-page .page-btn,
.forum-category-page .page-dots {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 .75rem;
}

.forum-category-page .page-btn {
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.forum-category-page .page-btn.active,
.forum-category-page .page-btn:hover {
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.forum-category-page .page-dots {
    color: var(--mk-muted, #64748b);
    font-weight: 900;
}

@media(max-width: 900px) {
    .forum-category-page .category-header-box {
        align-items: flex-start;
        flex-direction: column;
    }

    .forum-category-page .category-search-box {
        grid-template-columns: 1fr;
    }

    .forum-category-page .forum-topic-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .forum-category-page .forum-topic-filter-tabs a,
    .forum-category-page .forum-topic-sort-form,
    .forum-category-page .forum-topic-sort-form select {
        width: 100%;
    }

    .forum-category-page .forum-topic-sort-form {
        justify-content: space-between;
    }

    .forum-category-page .forum-subcategory-head,
    .forum-category-page .forum-subcategory-card {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .forum-category-page .forum-subcategory-head {
        flex-direction: column;
    }

    .forum-category-page .forum-subcategory-total {
        align-self: flex-start;
    }

    .forum-category-page .forum-subcategory-meta,
    .forum-category-page .forum-subcategory-go {
        display: none;
    }

    .forum-category-page .forum-subcategory-last {
        grid-column: 2;
    }

    .forum-category-page .category-search-box button,
    .forum-category-page .category-search-clear,
    .forum-category-page .btn-new-topic {
        width: 100%;
    }

    .forum-category-page .topic-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .forum-category-page .topic-last-reply,
    .forum-category-page .topic-unread-link {
        justify-content: center;
        width: 100%;
    }

    .forum-category-page .topic-stats {
        grid-column: 1 / -1;
        justify-content: space-between;
        padding-top: .85rem;
        border-top: 1px solid var(--mk-line, #e4dfd7);
    }
}

@media(max-width: 640px) {
    .forum-category-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .forum-category-page .topic-card {
        grid-template-columns: 1fr;
    }

    .forum-category-page .forum-subcategory-card {
        grid-template-columns: 1fr;
    }

    .forum-category-page .forum-subcategory-icon {
        display: none;
    }

    .forum-category-page .forum-subcategory-body strong {
        white-space: normal;
    }

    .forum-category-page .forum-subcategory-last {
        grid-column: 1;
    }

    .forum-category-page .topic-stats {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Phase 13: forum topic detail */
.forum-topic-detail-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
    background: transparent !important;
}

.forum-topic-detail-page .breadcrumb-modern {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    margin: 0 0 1rem;
    padding: .78rem .95rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-topic-detail-page .breadcrumb-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
}

.forum-topic-detail-page .breadcrumb-separator,
.forum-topic-detail-page .breadcrumb-current {
    color: var(--mk-muted, #64748b);
}

.forum-topic-detail-page .alert-modern {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin: 0 0 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    color: var(--mk-ink, #18181b);
}

.forum-topic-detail-page .alert-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.forum-topic-detail-page .alert-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.forum-topic-detail-page .alert-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.forum-topic-detail-page .topic-header-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.forum-topic-detail-page .topic-title-section {
    min-width: 0;
}

.forum-topic-detail-page .topic-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-bottom: .65rem;
}

.forum-topic-detail-page .topic-badge {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    padding: .34rem .62rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 900;
}

.forum-topic-detail-page .badge-pinned {
    border: 1px solid #fde68a;
    background: rgba(255, 251, 235, .14);
    color: #fde68a;
}

.forum-topic-detail-page .badge-locked {
    border: 1px solid #fecaca;
    background: rgba(254, 242, 242, .14);
    color: #fecaca;
}

.forum-topic-detail-page .topic-title {
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: 0;
}

.forum-topic-detail-page .topic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: .9rem;
}

.forum-topic-detail-page .meta-item {
    display: inline-flex;
    align-items: center;
    gap: .32rem;
    padding: .42rem .68rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .09);
    color: rgba(255, 255, 255, .86);
    font-size: .82rem;
    font-weight: 900;
}

.forum-topic-detail-page .meta-label {
    color: rgba(255, 255, 255, .66);
    font-weight: 800;
}

.forum-topic-detail-page .topic-actions .inline-form,
.forum-topic-detail-page .footer-actions,
.forum-topic-detail-page .form-actions-modern {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.forum-topic-detail-page .action-btn,
.forum-topic-detail-page .btn-modern,
.forum-topic-detail-page .btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 38px;
    padding: 0 .78rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
    letter-spacing: 0;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
}

.forum-topic-detail-page .btn-submit,
.forum-topic-detail-page .btn-save {
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.forum-topic-detail-page .btn-submit:hover,
.forum-topic-detail-page .btn-save:hover {
    background: var(--mk-brand-strong, #5f1515);
}

.forum-topic-detail-page .btn-thank,
.forum-topic-detail-page .btn-edit,
.forum-topic-detail-page .btn-cancel,
.forum-topic-detail-page .btn-thanked {
    background: var(--mk-surface-muted, #f8fafc);
}

.forum-topic-detail-page .btn-delete,
.forum-topic-detail-page .btn-delete-small {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.forum-topic-detail-page .post-card {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    margin: 0 0 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-topic-detail-page .post-card.is-reply-target {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .16), var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    animation: mkReplyTargetPulse 1.1s ease-in-out 2;
}

@keyframes mkReplyTargetPulse {
    0%, 100% {
        background: #fff;
    }
    50% {
        background: #eff6ff;
    }
}

.forum-topic-detail-page .post-sidebar {
    padding: 1rem;
    border-right: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
}

.forum-topic-detail-page .user-profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    text-align: center;
}

.forum-topic-detail-page .user-avatar-link {
    display: inline-flex;
    text-decoration: none;
}

.forum-topic-detail-page .user-avatar {
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid color-mix(in srgb, var(--rank-color, var(--mk-brand, #7f1d1d)) 46%, transparent);
    border-radius: 50%;
    background: var(--rank-color, var(--mk-brand, #7f1d1d));
    color: #fff;
    font-size: 1.45rem;
    font-weight: 900;
    object-fit: cover;
}

.forum-topic-detail-page img.user-avatar {
    background: #fff;
}

.forum-topic-detail-page .username-link {
    color: var(--rank-color, var(--mk-brand, #7f1d1d));
    font-size: 1rem;
    font-weight: 900;
    text-decoration: none;
    word-break: break-word;
}

.forum-topic-detail-page .user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .42rem;
    max-width: 100%;
    padding: .42rem .72rem;
    border: 1px solid color-mix(in srgb, var(--rank-color, var(--mk-brand, #7f1d1d)) 34%, transparent);
    border-radius: 999px;
    background:
        radial-gradient(circle at 35% 20%, rgba(255, 255, 255, .82), transparent 34%),
        color-mix(in srgb, var(--rank-color, var(--mk-brand, #7f1d1d)) 10%, white);
}

.forum-topic-detail-page .badge-title {
    color: var(--rank-color, var(--mk-ink, #18181b));
    font-size: .78rem;
    font-weight: 900;
    white-space: nowrap;
}

.forum-topic-detail-page .user-stats-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
}

.forum-topic-detail-page .user-stats-grid .stat-item {
    display: grid;
    gap: .1rem;
    padding: .55rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-muted, #64748b);
}

.forum-topic-detail-page .stat-value {
    color: var(--mk-ink, #18181b);
    font-size: .92rem;
    font-weight: 900;
}

.forum-topic-detail-page .stat-label {
    color: var(--mk-muted, #64748b);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: 0;
}

.forum-topic-detail-page .user-info-section,
.forum-topic-detail-page .member-since,
.forum-topic-detail-page .user-achievements {
    width: 100%;
    padding-top: .7rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
}

.forum-topic-detail-page .info-item,
.forum-topic-detail-page .member-since {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 800;
}

.forum-topic-detail-page .achievements-header {
    margin-bottom: .45rem;
    color: var(--mk-ink-soft, #334155);
    font-size: .78rem;
    font-weight: 900;
}

.forum-topic-detail-page .achievements-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .35rem;
}

.forum-topic-detail-page .achievement-icon,
.forum-topic-detail-page .achievement-more {
    min-width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    font-size: .9rem;
    font-weight: 900;
}

.forum-topic-detail-page .post-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.forum-topic-detail-page .post-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
    font-weight: 800;
}

.forum-topic-detail-page .edited-badge,
.forum-topic-detail-page .thanks-badge {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    padding: .3rem .58rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 900;
}

.forum-topic-detail-page .edited-badge {
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1e40af;
}

.forum-topic-detail-page .thanks-badge {
    border: 1px solid #f5d0d0;
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
}

.forum-topic-detail-page .post-body {
    flex: 1;
    padding: 1.1rem;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    line-height: 1.78;
    word-break: break-word;
}

.forum-topic-detail-page .post-body p:first-child {
    margin-top: 0;
}

.forum-topic-detail-page .post-body p:last-child {
    margin-bottom: 0;
}

.forum-topic-detail-page .post-body blockquote {
    margin: 1rem 0;
    padding: .85rem 1rem;
    border-left: 4px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
}

.forum-topic-detail-page .post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--mk-radius, 8px);
}

.forum-topic-detail-page .forum-post-signature {
    margin: 0 1.1rem 1rem;
    padding: .75rem 0 0;
    border-top: 1px dashed rgba(100, 116, 139, .32);
    color: #64748b;
}

.forum-topic-detail-page .forum-post-signature span {
    display: inline-flex;
    margin-bottom: .25rem;
    color: #7f1d1d;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.forum-topic-detail-page .forum-post-signature p {
    margin: 0;
    font-size: .9rem;
    line-height: 1.55;
}

.forum-topic-detail-page .post-footer {
    padding: .9rem 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
}

.forum-topic-detail-page .replies-section {
    margin-top: 1rem;
}

.forum-topic-detail-page .section-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0 0 .85rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.18rem;
    font-weight: 900;
}

.forum-topic-detail-page .reply-section {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-topic-detail-page .reply-form-modern,
.forum-topic-detail-page .edit-form-modern {
    display: grid;
    gap: .8rem;
}

.forum-topic-detail-page .form-group-modern {
    display: grid;
    gap: .4rem;
}

.forum-topic-detail-page .form-label {
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
}

.forum-topic-detail-page .form-input-modern,
.forum-topic-detail-page .form-textarea-modern {
    width: 100%;
    min-width: 0;
    padding: .85rem .95rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    line-height: 1.55;
}

.forum-topic-detail-page .form-hint {
    color: var(--mk-muted, #64748b);
    font-weight: 800;
}

.forum-topic-detail-page .inline-form {
    display: inline-flex;
    margin: 0;
}

@media(max-width: 980px) {
    .forum-topic-detail-page .topic-header-card {
        flex-direction: column;
    }

    .forum-topic-detail-page .post-card {
        grid-template-columns: 1fr;
    }

    .forum-topic-detail-page .post-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--mk-line, #e4dfd7);
    }

    .forum-topic-detail-page .user-profile-card {
        align-items: flex-start;
        text-align: left;
    }

    .forum-topic-detail-page .user-stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .forum-topic-detail-page .user-info-section,
    .forum-topic-detail-page .member-since,
    .forum-topic-detail-page .user-achievements {
        text-align: left;
    }
}

@media(max-width: 640px) {
    .forum-topic-detail-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .forum-topic-detail-page .topic-actions,
    .forum-topic-detail-page .topic-actions .inline-form,
    .forum-topic-detail-page .btn-modern,
    .forum-topic-detail-page .btn-submit {
        width: 100%;
    }

    .forum-topic-detail-page .user-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .forum-topic-detail-page .post-header,
    .forum-topic-detail-page .post-footer,
    .forum-topic-detail-page .footer-actions,
    .forum-topic-detail-page .form-actions-modern {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Phase 14: new forum topic form */
.new-topic-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    min-height: auto !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
    background: transparent !important;
}

.new-topic-page::before {
    display: none !important;
}

.new-topic-page .new-topic-container,
.new-topic-page .new-topic-wrapper {
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.new-topic-page .topic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1rem;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.new-topic-page .header-content {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .9rem;
}

.new-topic-page .header-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .1);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
    font-size: 1.35rem;
}

.new-topic-page .header-text {
    min-width: 0;
}

.new-topic-page .header-text h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: 0;
}

.new-topic-page .header-text p {
    margin: .45rem 0 0;
    color: rgba(255, 255, 255, .76);
    font-size: .98rem;
}

.new-topic-page .back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: .72rem 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.new-topic-page .back-button:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

.new-topic-page .error-alert,
.new-topic-page .info-card,
.new-topic-page .warning-box,
.new-topic-page .topic-form-card {
    margin: 0 0 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.new-topic-page .error-alert,
.new-topic-page .info-card,
.new-topic-page .warning-box {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1rem;
}

.new-topic-page .error-alert {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 800;
}

.new-topic-page .info-card {
    border-color: #dbeafe;
    background: #eff6ff;
    color: #1e40af;
}

.new-topic-page .info-icon {
    flex: 0 0 auto;
    font-size: 1.25rem;
}

.new-topic-page .info-content h3,
.new-topic-page .warning-box strong {
    margin: 0 0 .35rem;
    color: inherit;
    font-size: 1rem;
    font-weight: 900;
}

.new-topic-page .info-content p,
.new-topic-page .warning-box p {
    margin: 0;
    color: inherit;
    line-height: 1.65;
}

.new-topic-page .warning-box {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.new-topic-page .warning-box svg {
    flex: 0 0 auto;
}

.new-topic-page .topic-form-card {
    padding: clamp(1rem, 2.4vw, 1.5rem);
}

.new-topic-page .topic-form {
    display: grid;
    gap: 1rem;
}

.new-topic-page .input-group {
    display: grid;
    gap: .5rem;
}

.new-topic-page .input-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.new-topic-page .required-star {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
}

.new-topic-page .optional-badge {
    display: inline-flex;
    align-items: center;
    padding: .22rem .5rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    font-weight: 900;
}

.new-topic-page .custom-input,
.new-topic-page .custom-textarea,
.new-topic-page .dropdown-trigger,
.new-topic-page .dropdown-search input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
}

.new-topic-page .custom-input,
.new-topic-page .dropdown-trigger {
    min-height: 44px;
    padding: 0 .9rem;
}

.new-topic-page .custom-textarea {
    min-height: 180px;
    padding: .85rem .95rem;
    line-height: 1.65;
    resize: vertical;
}

.new-topic-page .custom-input:focus,
.new-topic-page .custom-textarea:focus,
.new-topic-page .dropdown-trigger:focus,
.new-topic-page .dropdown-trigger.active,
.new-topic-page .dropdown-search input:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
    outline: 0;
}

.new-topic-page .custom-dropdown {
    position: relative;
}

.new-topic-page .dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    cursor: pointer;
    text-align: left;
}

.new-topic-page .selected-text {
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.new-topic-page .selected-text.placeholder {
    color: var(--mk-muted, #64748b);
    font-weight: 700;
}

.new-topic-page .dropdown-arrow {
    flex: 0 0 auto;
    color: var(--mk-muted, #64748b);
    transition: transform .18s ease;
}

.new-topic-page .dropdown-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

.new-topic-page .dropdown-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + .45rem);
    z-index: 30;
    display: none;
    max-height: 360px;
    overflow: hidden;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: 0 20px 48px rgba(24, 24, 27, .16);
}

.new-topic-page .dropdown-menu.active {
    display: block;
}

.new-topic-page .dropdown-search {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .8rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    color: var(--mk-muted, #64748b);
}

.new-topic-page .dropdown-search input {
    min-height: 38px;
    padding: 0 .75rem;
}

.new-topic-page .dropdown-options {
    max-height: 280px;
    overflow-y: auto;
    padding: .45rem;
}

.new-topic-page .group-header {
    padding: .55rem .7rem .35rem;
    color: var(--mk-muted, #64748b);
    font-size: .75rem;
    font-weight: 900;
}

.new-topic-page .option-item {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: .55rem .7rem;
    border-radius: var(--mk-radius, 8px);
    color: var(--mk-ink, #18181b);
    cursor: pointer;
    font-weight: 800;
}

.new-topic-page .option-item:hover,
.new-topic-page .option-item.selected {
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
}

.new-topic-page .option-item.hidden {
    display: none;
}

.new-topic-page .similar-suggestions {
    margin-top: .6rem;
}

.new-topic-page .helper-text {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 800;
}

.new-topic-page .form-actions {
    display: flex;
    justify-content: flex-end;
}

.new-topic-page .submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 46px;
    padding: 0 1.15rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-weight: 900;
    letter-spacing: 0;
    cursor: pointer;
    box-shadow: none;
}

.new-topic-page .submit-button:hover {
    background: var(--mk-brand-strong, #5f1515);
}

.new-topic-page .preview-toggle {
    display: flex;
    gap: .4rem;
    padding: .35rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
}

.new-topic-page .preview-btn {
    flex: 1;
    min-height: 36px;
    border: 0;
    border-radius: var(--mk-radius, 8px);
    background: transparent;
    color: var(--mk-muted, #64748b);
    cursor: pointer;
    font-weight: 900;
}

.new-topic-page .preview-btn.active {
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.new-topic-page .draft-indicator,
.new-topic-page .input-error {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 800;
}

.new-topic-page .input-error {
    color: #991b1b;
}

.new-topic-page .input-group.has-error .custom-input,
.new-topic-page .input-group.has-error .custom-textarea,
.new-topic-page .input-group.has-error .dropdown-trigger {
    border-color: #dc2626;
}

@media(max-width: 760px) {
    .new-topic-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .new-topic-page .topic-header,
    .new-topic-page .header-content,
    .new-topic-page .info-card,
    .new-topic-page .warning-box {
        align-items: flex-start;
        flex-direction: column;
    }

    .new-topic-page .back-button,
    .new-topic-page .submit-button {
        width: 100%;
    }

    .new-topic-page .form-actions {
        justify-content: stretch;
    }
}

/* New topic final responsive lock. */
.new-topic-page,
.new-topic-page *,
.new-topic-page *::before,
.new-topic-page *::after {
    box-sizing: border-box;
}

.new-topic-page .topic-header,
.new-topic-page .error-alert,
.new-topic-page .info-card,
.new-topic-page .warning-box,
.new-topic-page .topic-form-card {
    width: 100%;
    max-width: 100%;
}

.new-topic-page .forum-prefix-picker,
.new-topic-page .forum-poll-options-grid {
    min-width: 0;
}

.new-topic-page .forum-prefix-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.new-topic-page .forum-prefix-option {
    min-width: 0;
}

.new-topic-page .forum-prefix-option > span {
    max-width: 100%;
    white-space: normal;
}

.new-topic-page .forum-poll-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

@media(max-width: 760px) {
    .new-topic-page {
        width: min(100% - .75rem, var(--content-wide, 1400px)) !important;
    }

    .new-topic-page .topic-header {
        gap: 1rem;
    }

    .new-topic-page .header-content {
        width: 100%;
        flex-direction: row;
        align-items: center;
    }

    .new-topic-page .header-text h1 {
        font-size: clamp(1.65rem, 9vw, 2.2rem);
    }

    .new-topic-page .header-text p,
    .new-topic-page .info-content p,
    .new-topic-page .warning-box p,
    .new-topic-page .helper-text {
        overflow-wrap: anywhere;
    }

    .new-topic-page .dropdown-menu {
        position: fixed;
        inset: auto .5rem .5rem;
        z-index: 1000;
        max-height: min(70dvh, 520px);
    }

    .new-topic-page .dropdown-options {
        max-height: calc(min(70dvh, 520px) - 64px);
    }

    .new-topic-page .forum-prefix-picker,
    .new-topic-page .forum-poll-options-grid {
        grid-template-columns: 1fr;
    }

    .new-topic-page .forum-prefix-picker {
        display: grid;
    }

    .new-topic-page .forum-prefix-option,
    .new-topic-page .forum-prefix-option > span {
        width: 100%;
    }

    .new-topic-page .custom-input,
    .new-topic-page .custom-textarea,
    .new-topic-page .dropdown-trigger,
    .new-topic-page .dropdown-search input {
        font-size: 16px;
    }
}

@media(max-width: 420px) {
    .new-topic-page .header-icon {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    .new-topic-page .topic-form-card,
    .new-topic-page .info-card,
    .new-topic-page .warning-box {
        padding: .85rem;
    }
}

/* Phase 15: user profile unified layout */
.profile-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
}

.profile-page .alert {
    margin: 0 0 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    font-weight: 800;
}

.profile-page .alert-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.profile-page .alert-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.profile-page .profile-container {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.profile-page .profile-sidebar {
    position: sticky;
    top: 1rem;
}

.profile-page .profile-card {
    overflow: hidden;
    padding: 1.15rem;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
    text-align: center;
}

.profile-page .profile-avatar {
    position: relative;
    width: 128px;
    height: 128px;
    margin: 0 auto 1rem;
    border: 3px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
}

.profile-page .profile-avatar img,
.profile-page .profile-avatar .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    object-fit: cover;
}

.profile-page .profile-avatar .avatar-placeholder {
    background: var(--rank-color, rgba(255, 255, 255, .12));
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
}

.profile-page .profile-avatar-rank {
    position: absolute;
    right: -4px;
    bottom: 4px;
}

.profile-page .profile-username,
.profile-page .profile-card h1 {
    margin: 0;
    color: var(--rank-color, #fff) !important;
    font-size: clamp(1.65rem, 2.2vw, 2.1rem);
    font-weight: 900;
    line-height: 1.12;
    letter-spacing: 0;
    word-break: break-word;
}

.profile-page .profile-role-badge {
    display: flex;
    justify-content: center;
    margin: .75rem 0;
}

.profile-page .profile-role-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    max-width: 100%;
    padding: .45rem .8rem;
    border: 1px solid color-mix(in srgb, var(--rank-color, #fff) 38%, rgba(255, 255, 255, .18));
    border-radius: 999px;
    background:
        radial-gradient(circle at 35% 20%, rgba(255, 255, 255, .82), transparent 34%),
        color-mix(in srgb, var(--rank-color, #fff) 16%, rgba(255, 255, 255, .12));
}

.profile-page .profile-role-pill.rank-special-package {
    --rank-color: var(--special-badge-border, #991b1b);
    color: var(--special-badge-color, #fff);
    border-color: var(--special-badge-border, #991b1b);
    background: var(--special-badge-bg, #7f1d1d);
}

.profile-page .profile-role-title {
    color: var(--rank-color, #fff);
    font-size: .86rem;
    font-weight: 900;
    letter-spacing: 0;
    white-space: nowrap;
}

.profile-page .profile-role-pill.rank-special-package .profile-role-title {
    color: var(--special-badge-color, #fff);
}

.profile-page .profile-bio {
    margin-top: 1rem;
    padding: .9rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .78);
    line-height: 1.65;
    text-align: left;
}

.profile-page .profile-bio p {
    margin: 0;
}

.profile-page .profile-forum-signature {
    margin-top: .85rem;
    padding: .8rem .9rem;
    border: 1px dashed rgba(127, 29, 29, .22);
    border-radius: 10px;
    background: #fff7ed;
    color: #475569;
}

.profile-page .profile-forum-signature span {
    display: inline-flex;
    margin-bottom: .35rem;
    color: #7f1d1d;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.profile-page .profile-forum-signature p {
    margin: 0;
    font-size: .92rem;
    line-height: 1.55;
}

.profile-page .profile-stats-mini {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    margin: 1rem 0;
}

.profile-page .stat-mini,
.profile-page .profile-info-chip,
.profile-page .profile-meta {
    padding: .8rem;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .08);
}

.profile-page .profile-info-chip {
    margin-bottom: .75rem;
    text-align: left;
}

.profile-page .profile-info-city {
    border-left: 4px solid #f59e0b;
}

.profile-page .profile-info-institution {
    border-left: 4px solid #16a34a;
}

.profile-page .profile-info-label,
.profile-page .stat-label,
.profile-page .profile-meta p {
    color: rgba(255, 255, 255, .68);
    font-size: .78rem;
    font-weight: 800;
}

.profile-page .profile-info-value,
.profile-page .stat-value,
.profile-page .profile-meta strong {
    color: #fff;
    font-weight: 900;
}

.profile-page .profile-info-value {
    margin-top: .25rem;
}

.profile-page .profile-meta {
    margin-bottom: 1rem;
    text-align: left;
}

.profile-page .profile-meta p {
    margin: .25rem 0;
}

.profile-page .profile-actions,
.profile-page .profile-card > .btn {
    display: grid;
    gap: .55rem;
}

.profile-page .btn,
.profile-page button.btn,
.profile-page .btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 40px;
    padding: 0 .9rem;
    border-radius: var(--mk-radius, 8px) !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
    text-decoration: none !important;
    box-shadow: none !important;
    cursor: pointer;
}

.profile-page .btn-primary {
    border: 1px solid var(--mk-brand, #7f1d1d) !important;
    background: var(--mk-brand, #7f1d1d) !important;
    color: #fff !important;
}

.profile-page .btn-primary:hover {
    background: var(--mk-brand-strong, #5f1515) !important;
}

.profile-page .btn-secondary {
    border: 1px solid rgba(255, 255, 255, .18) !important;
    background: rgba(255, 255, 255, .1) !important;
    color: #fff !important;
}

.profile-page .profile-content {
    display: grid;
    gap: 1rem;
}

.profile-page .content-section,
.profile-page .invite-create-box,
.profile-page .no-quota-box,
.profile-page .no-invitations-state {
    padding: clamp(1rem, 2.2vw, 1.35rem);
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.profile-page .content-section h2,
.profile-page .content-section h3 {
    margin: 0 0 .9rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.18rem;
    font-weight: 900;
    letter-spacing: 0;
}

.profile-page .content-section form,
.profile-page .form-group {
    display: grid;
    gap: .65rem;
}

.profile-page .form-group {
    margin-bottom: .9rem;
}

.profile-page label {
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
}

.profile-page input,
.profile-page select,
.profile-page textarea {
    width: 100%;
    min-width: 0;
    padding: .78rem .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
}

.profile-page textarea {
    line-height: 1.6;
    resize: vertical;
}

.profile-page small {
    color: var(--mk-muted, #64748b);
    line-height: 1.5;
}

.profile-page .invite-stats-bar,
.profile-page .invite-info-grid,
.profile-page .stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .75rem;
}

.profile-page .invite-stats-bar {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.profile-page .stat-item,
.profile-page .invite-stat,
.profile-page .stat-box {
    padding: .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    text-align: center;
}

.profile-page .stat-highlight {
    border-color: #f5d0d0;
    background: #fff7f7;
}

.profile-page .stat-number,
.profile-page .invite-number,
.profile-page .stat-box .stat-number {
    color: var(--mk-brand, #7f1d1d);
    font-size: 1.4rem;
    font-weight: 900;
}

.profile-page .stat-name,
.profile-page .invite-label {
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 900;
}

.profile-page .stat-icon,
.profile-page .empty-icon {
    margin-bottom: .35rem;
    font-size: 1.35rem;
    line-height: 1;
}

.profile-page .invite-create-box,
.profile-page .no-quota-box {
    margin: 1rem 0;
    background: #fff7f7;
    border-color: #f5d0d0;
    color: var(--mk-brand, #7f1d1d);
}

.profile-page .invite-create-form {
    display: inline-flex;
    margin-top: .65rem;
}

.profile-page .invitations-table {
    overflow-x: auto;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.profile-page .invitations-table table {
    width: 100%;
    border-collapse: collapse;
}

.profile-page .invitations-table th,
.profile-page .invitations-table td {
    padding: .8rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    color: var(--mk-ink-soft, #334155);
    text-align: left;
    vertical-align: middle;
}

.profile-page .invitations-table th {
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink, #18181b);
    font-size: .78rem;
    font-weight: 900;
}

.profile-page .invite-code {
    padding: .28rem .5rem;
    border-radius: var(--mk-radius, 8px);
    background: #111827;
    color: #fff;
    font-weight: 900;
}

.profile-page .status-badge,
.profile-page .type-badge {
    display: inline-flex;
    align-items: center;
    padding: .28rem .55rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 900;
}

.profile-page .status-used {
    background: #f1f5f9;
    color: #475569;
}

.profile-page .status-active {
    background: #f0fdf4;
    color: #166534;
}

.profile-page .muted-dash {
    color: #9ca3af;
}

.profile-page .invite-used-user,
.profile-page .thank-username {
    color: var(--rank-color, var(--mk-brand, #7f1d1d));
    font-weight: 900;
    text-decoration: none;
}

.profile-page .btn-copy {
    min-width: 38px;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
}

.profile-page .phone-verify-box {
    margin-top: .9rem;
    padding: 1rem;
    border: 1px solid #bbf7d0;
    border-radius: var(--mk-radius-lg, 10px);
    background: #f0fdf4;
}

.profile-page .phone-verify-box h3 {
    margin: 0 0 .5rem;
    color: #166534;
    font-size: 1rem;
    font-weight: 900;
}

.profile-page .phone-verify-box p {
    margin: 0 0 .75rem;
    color: #166534;
    line-height: 1.55;
}

.profile-page .badges-grid,
.profile-page .activity-list,
.profile-page .thanks-list {
    display: grid;
    gap: .75rem;
}

.profile-page .badge-item,
.profile-page .activity-item,
.profile-page .thank-item {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
}

.profile-page .badge-icon,
.profile-page .activity-icon,
.profile-page .thank-avatar,
.profile-page .avatar-mini {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
}

.profile-page .thank-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-page .badge-name,
.profile-page .activity-title,
.profile-page .thank-topic {
    color: var(--mk-ink, #18181b);
    font-weight: 900;
    text-decoration: none;
}

.profile-page .badge-desc,
.profile-page .activity-time,
.profile-page .thank-time,
.profile-page .thank-preview {
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
}

.profile-page .thank-item {
    justify-content: space-between;
}

.profile-page .thank-from {
    display: flex;
    gap: .65rem;
    align-items: center;
}

.profile-page .thank-info,
.profile-page .badge-info,
.profile-page .activity-content,
.profile-page .thank-detail {
    min-width: 0;
}

.profile-page .thank-info {
    display: grid;
    gap: .15rem;
}

.profile-page .thank-detail {
    display: grid;
    gap: .35rem;
    text-align: right;
}

.profile-page .thank-type {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .35rem;
}

.profile-page .thank-puan {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
}

.profile-page .profile-empty-note {
    margin: 0;
    padding: 2rem;
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.profile-page .verify-code-input {
    text-align: center;
    font-size: 1.4rem;
    letter-spacing: 5px;
}

@media(max-width: 1100px) {
    .profile-page .profile-container {
        grid-template-columns: 1fr;
    }

    .profile-page .profile-sidebar {
        position: static;
    }

    .profile-page .invite-stats-bar,
    .profile-page .invite-info-grid,
    .profile-page .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media(max-width: 640px) {
    .profile-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .profile-page .invite-stats-bar,
    .profile-page .invite-info-grid,
    .profile-page .stats-grid,
    .profile-page .profile-stats-mini {
        grid-template-columns: 1fr;
    }

    .profile-page .profile-card {
        padding: 1rem;
    }

    .profile-page .thank-item,
    .profile-page .badge-item,
    .profile-page .activity-item {
        flex-direction: column;
    }

    .profile-page .thank-detail {
        text-align: left;
    }

    .profile-page .thank-type {
        justify-content: flex-start;
    }
}

/* Phase 16: users directory unified layout */
.users-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.75rem !important;
}

.users-page .page-header {
    position: relative;
    margin-bottom: 1rem;
    padding: clamp(1.1rem, 2.6vw, 1.55rem);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96), rgba(39, 39, 42, .98) 58%, rgba(127, 29, 29, .94));
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.users-page .page-header h1 {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0;
}

.users-page .page-header p {
    margin: .75rem 0 0;
}

.users-page .member-count {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 .85rem;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .86);
    font-size: .88rem;
    font-weight: 900;
}

.users-page .filter-bar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(170px, auto) minmax(150px, auto) auto auto;
    gap: .75rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.users-page .search-box {
    position: relative;
    min-width: 0;
}

.users-page .search-box > .mk-icon {
    position: absolute;
    left: .85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mk-muted, #64748b);
    pointer-events: none;
    width: 1rem;
    height: 1rem;
}

.users-page .search-box input,
.users-page .filter-select {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    font-weight: 800;
}

.users-page .search-box input {
    padding: 0 .9rem 0 2.5rem;
}

.users-page .filter-select {
    padding: 0 2rem 0 .85rem;
    cursor: pointer;
}

.users-page .search-box input:focus,
.users-page .filter-select:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
    outline: 0;
}

.users-page .search-btn,
.users-page .clear-btn,
.users-page .btn-primary,
.users-page .page-btn,
.users-page .user-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 42px;
    padding: 0 .95rem;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
    letter-spacing: 0;
    text-decoration: none;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.users-page .search-btn,
.users-page .btn-primary,
.users-page .page-btn.active {
    border: 1px solid var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.users-page .search-btn:hover,
.users-page .btn-primary:hover,
.users-page .page-btn.active:hover {
    background: var(--mk-brand-strong, #5f1515);
    color: #fff;
}

.users-page .clear-btn,
.users-page .page-btn,
.users-page .user-action {
    border: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
}

.users-page .clear-btn:hover,
.users-page .page-btn:hover,
.users-page .user-card:hover .user-action {
    border-color: var(--mk-brand, #7f1d1d);
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
}

.users-page .users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.users-page .users-rank-groups {
    display: grid;
    gap: 1.35rem;
}

.users-page .users-rank-group {
    display: grid;
    gap: 1rem;
}

.users-page .users-rank-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid color-mix(in srgb, var(--rank-accent, var(--mk-brand, #7f1d1d)) 18%, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, color-mix(in srgb, var(--rank-accent, var(--mk-brand, #7f1d1d)) 10%, #fff) 0%, #fff 70%);
    box-shadow: 0 10px 24px rgba(24, 24, 27, .05);
}

.users-page .users-rank-group-head h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--rank-accent, var(--mk-ink, #18181b));
}

.users-page .users-rank-group-head p {
    margin: .25rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .92rem;
}

.users-page .users-rank-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 36px;
    padding: 0 .75rem;
    border-radius: 999px;
    background: #fff;
    color: var(--rank-accent, var(--mk-brand, #7f1d1d));
    border: 1px solid color-mix(in srgb, var(--rank-accent, var(--mk-brand, #7f1d1d)) 24%, #e4dfd7);
    font-weight: 900;
}

.users-page .user-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    text-decoration: none;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.users-page .user-card:hover {
    border-color: rgba(127, 29, 29, .28);
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(24, 24, 27, .12);
}

.users-page .user-card-header {
    display: flex;
    gap: .85rem;
    align-items: center;
    min-width: 0;
}

.users-page .user-avatar {
    position: relative;
    width: 68px;
    height: 68px;
    flex: 0 0 68px;
}

.users-page .user-avatar-circle {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--rank-color, #6b7280);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 900;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .2), 0 10px 22px rgba(24, 24, 27, .12);
}

.users-page .user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.users-page .user-status {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 16px;
    height: 16px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 4px 12px rgba(22, 163, 74, .35);
}

.users-page .user-status.offline {
    background: #94a3b8;
    box-shadow: none;
}

.users-page .user-main-info {
    min-width: 0;
}

.users-page .user-name,
.users-page .user-main-info h3 {
    overflow: hidden;
    margin: 0;
    color: var(--rank-color, var(--mk-ink, #18181b));
    font-size: 1.08rem;
    font-weight: 900;
    line-height: 1.18;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.users-page .user-role-wrap {
    margin-top: .32rem;
}

.users-page .role-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    gap: .35rem;
    padding: .28rem .65rem;
    border: 1px solid color-mix(in srgb, var(--rank-color, var(--mk-brand, #7f1d1d)) 34%, transparent);
    border-radius: 999px;
    background:
        radial-gradient(circle at 35% 20%, rgba(255, 255, 255, .82), transparent 34%),
        color-mix(in srgb, var(--rank-color, var(--mk-brand, #7f1d1d)) 10%, white);
    color: var(--rank-color, var(--mk-ink-soft, #334155));
    font-size: .78rem;
    font-weight: 900;
    line-height: 1.2;
}

.users-page .user-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .65rem;
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
}

.users-page .stat-item {
    min-width: 0;
    padding: .7rem .45rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    text-align: center;
}

.users-page .stat-value {
    display: block;
    color: var(--mk-brand, #7f1d1d);
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;
}

.users-page .stat-label {
    display: block;
    margin-top: .28rem;
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    font-weight: 900;
}

.users-page .user-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
}

.users-page .user-date {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 800;
}

.users-page .user-action {
    min-height: 34px;
    padding: 0 .7rem;
    font-size: .82rem;
}

.users-page .empty-state {
    padding: clamp(1.4rem, 4vw, 2.2rem);
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    text-align: center;
}

.users-page .empty-state-icon {
    font-size: 2.6rem;
    line-height: 1;
}

.users-page .empty-state h3 {
    margin: .75rem 0 .35rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.25rem;
    font-weight: 900;
}

.users-page .empty-state p {
    max-width: 560px;
    margin: 0 auto 1rem;
    color: var(--mk-muted, #64748b);
    line-height: 1.65;
}

.users-page .pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .45rem;
    margin-top: 1.25rem;
}

.users-page .page-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 .4rem;
    color: var(--mk-muted, #64748b);
    font-weight: 900;
}

@media(max-width: 980px) {
    .users-page .filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .users-page .search-box {
        grid-column: 1 / -1;
    }
}

@media(max-width: 640px) {
    .users-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .users-page .filter-bar,
    .users-page .users-grid {
        grid-template-columns: 1fr;
    }

    .users-page .users-rank-group-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .users-page .user-card-header,
    .users-page .user-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .users-page .user-footer,
    .users-page .user-action,
    .users-page .search-btn,
    .users-page .clear-btn {
        width: 100%;
    }
}

/* Phase 17: messages unified layout */
.messages-container {
    width: min(100% - 2rem, var(--content-wide, 1400px));
    max-width: var(--content-wide, 1400px);
    min-height: calc(100vh - 150px);
    margin: 0 auto;
    padding: 1.25rem 0 2.5rem;
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 1rem;
}

.messages-container .conversations-panel,
.messages-container .chat-panel {
    min-height: 620px;
    overflow: hidden;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.messages-container .conversations-panel,
.messages-container .chat-panel {
    display: flex;
    flex-direction: column;
}

.messages-container .panel-header,
.messages-container .chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
    padding: 1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
}

.messages-container .panel-header h2 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0;
}

.messages-container .unread-badge,
.messages-container .conv-unread {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 .45rem;
    border-radius: 999px;
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-size: .75rem;
    font-weight: 900;
}

.messages-container .is-hidden {
    display: none !important;
}

.messages-container .limit-indicator {
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: #fff7f7;
}

.messages-container .limit-text {
    color: var(--mk-ink-soft, #334155);
    font-size: .86rem;
    font-weight: 900;
    line-height: 1.45;
}

.messages-container .limit-sent-count {
    display: block;
    margin-top: .15rem;
    color: var(--mk-muted, #64748b);
    font-weight: 800;
}

.messages-container .limit-bar {
    height: 8px;
    margin-top: .65rem;
    overflow: hidden;
    border-radius: 999px;
    background: #f1f5f9;
}

.messages-container .limit-progress {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 0;
    border-radius: inherit;
    background: transparent;
    appearance: none;
}

.messages-container .limit-progress::-webkit-progress-bar {
    border-radius: inherit;
    background: #f1f5f9;
}

.messages-container .limit-progress::-webkit-progress-value {
    border-radius: inherit;
    background: linear-gradient(90deg, #16a34a, #65a30d);
}

.messages-container .limit-progress::-moz-progress-bar {
    border-radius: inherit;
    background: linear-gradient(90deg, #16a34a, #65a30d);
}

.messages-container .conversations-list,
.messages-container .chat-messages {
    flex: 1;
    overflow-y: auto;
}

.messages-container .conversation-item {
    position: relative;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    padding: .9rem 1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    color: var(--mk-ink, #18181b);
    text-decoration: none;
    transition: background .16s ease, border-color .16s ease;
}

.messages-container .conversation-item:hover,
.messages-container .conversation-item.active {
    background: #fff7f7;
}

.messages-container .conversation-item.active::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--mk-brand, #7f1d1d);
}

.messages-container .conv-avatar,
.messages-container .chat-avatar,
.messages-container .message-avatar {
    position: relative;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
}

.messages-container .chat-avatar {
    width: 50px;
    height: 50px;
}

.messages-container .message-avatar {
    width: 36px;
    height: 36px;
}

.messages-container .mk-message-avatar-fill {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--rank-color, #6b7280);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 900;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .22), 0 8px 18px rgba(24, 24, 27, .12);
}

.messages-container .message-avatar .mk-message-avatar-fill {
    font-size: .95rem;
}

.messages-container .message-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.messages-container .online-dot {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 14px;
    height: 14px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #16a34a;
}

.messages-container .conv-content {
    min-width: 0;
}

.messages-container .conv-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
}

.messages-container .conv-username,
.messages-container .chat-username {
    overflow: hidden;
    color: var(--rank-color, var(--mk-ink, #18181b));
    font-weight: 900;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.messages-container .conv-time,
.messages-container .chat-status,
.messages-container .conv-preview,
.messages-container .message-time,
.messages-container .empty-hint {
    color: var(--mk-muted, #64748b);
    font-size: .8rem;
    font-weight: 800;
}

.messages-container .conv-preview {
    overflow: hidden;
    margin-top: .28rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.messages-container .you-prefix {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
}

.messages-container .empty-state,
.messages-container .empty-chat,
.messages-container .empty-messages {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 220px;
    padding: 1.2rem;
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.messages-container .empty-chat {
    flex: 1;
}

.messages-container .empty-chat-icon {
    font-size: 3rem;
    line-height: 1;
}

.messages-container .empty-chat h3 {
    margin: .75rem 0 .35rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.25rem;
    font-weight: 900;
}

.messages-container .empty-chat p,
.messages-container .empty-messages p,
.messages-container .empty-state p {
    margin: .2rem 0;
}

.messages-container .chat-user-info {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .8rem;
}

.messages-container .chat-actions {
    display: flex;
    gap: .45rem;
}

.messages-container .btn-icon,
.messages-container .btn-attach,
.messages-container .btn-send,
.messages-container .btn-remove-file,
.messages-container .btn-delete-message,
.messages-modal .btn-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
    cursor: pointer;
}

.messages-container .btn-icon,
.messages-container .btn-attach {
    width: 40px;
    height: 40px;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.messages-container .btn-icon:hover,
.messages-container .btn-attach:hover {
    border-color: var(--mk-brand, #7f1d1d);
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
}

.messages-container .btn-delete-conversation,
.messages-container .btn-delete-message,
.messages-modal .btn-delete {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.messages-container .chat-messages {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    padding: 1rem;
    background: #fafafa;
}

.messages-container .message {
    display: flex;
    gap: .65rem;
    max-width: min(78%, 720px);
    transition: opacity .3s ease, transform .3s ease;
}

.messages-container .message.is-removing {
    opacity: 0;
    transform: scale(.8);
}

.messages-container .message-sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.messages-container .message-received {
    align-self: flex-start;
}

.messages-container .message-content {
    min-width: 0;
}

.messages-container .message-bubble {
    position: relative;
    padding: .8rem .95rem;
    border-radius: var(--mk-radius-lg, 10px);
    line-height: 1.6;
    word-break: break-word;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.messages-container .message-sent .message-bubble {
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.messages-container .message-received .message-bubble {
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink, #18181b);
    border-bottom-left-radius: 4px;
}

.messages-container .message-time {
    display: flex;
    gap: .3rem;
    margin-top: .35rem;
}

.messages-container .message-sent .message-time {
    justify-content: flex-end;
}

.messages-container .message-attachment {
    margin-top: .65rem;
    padding-top: .65rem;
    border-top: 1px solid rgba(255, 255, 255, .24);
}

.messages-container .message-received .message-attachment {
    border-top-color: var(--mk-line, #e4dfd7);
}

.messages-container .attachment-link {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .35rem;
    color: inherit;
    font-weight: 900;
    text-decoration: none;
}

.messages-container .attachment-size {
    opacity: .74;
}

.messages-container .btn-delete-message {
    position: absolute;
    top: .35rem;
    right: .35rem;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, .25);
    opacity: 0;
    transition: opacity .16s ease;
}

.messages-container .message-bubble:hover .btn-delete-message {
    opacity: 1;
}

.messages-container .chat-input-area,
.messages-container .chat-blocked-notice {
    padding: 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
}

.messages-container .chat-input-area form {
    display: flex;
    align-items: flex-end;
    gap: .65rem;
}

.messages-container .visually-hidden-file {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.messages-container .file-preview {
    display: flex;
    align-items: center;
    gap: .5rem;
    max-width: 260px;
    min-height: 40px;
    padding: 0 .7rem;
    border: 1px solid #bbf7d0;
    border-radius: var(--mk-radius, 8px);
    background: #f0fdf4;
    color: #166534;
    font-size: .82rem;
    font-weight: 900;
}

.messages-container .btn-remove-file {
    min-width: 26px;
    height: 26px;
    border: 0;
    background: #dc2626;
    color: #fff;
}

.messages-container #messageInput {
    flex: 1;
    min-height: 44px;
    max-height: 150px;
    padding: .72rem .85rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    line-height: 1.45;
    resize: none;
}

.messages-container #messageInput:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
    outline: 0;
}

.messages-container .btn-send {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 1px solid var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.messages-container .btn-send:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.messages-container .chat-blocked-notice {
    color: #991b1b;
    font-weight: 900;
    text-align: center;
}

.messages-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, .62);
    backdrop-filter: blur(6px);
}

.messages-modal.active {
    display: flex;
}

.messages-modal .modal-container {
    width: min(100%, 520px);
    overflow: hidden;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.messages-modal .modal-small {
    width: min(100%, 420px);
}

.messages-modal .modal-header,
.messages-modal .modal-body,
.messages-modal .modal-footer {
    padding: 1rem;
}

.messages-modal .modal-header {
    text-align: center;
}

.messages-modal .modal-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.messages-modal .modal-title {
    margin: .6rem 0 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.25rem;
    font-weight: 900;
}

.messages-modal .modal-warning,
.messages-modal .modal-text,
.messages-modal .modal-note {
    margin: 0 0 .8rem;
    color: var(--mk-ink-soft, #334155);
    line-height: 1.6;
    text-align: center;
}

.messages-modal .modal-warning {
    padding: .8rem;
    border: 1px solid #fecaca;
    border-radius: var(--mk-radius, 8px);
    background: #fef2f2;
    color: #991b1b;
    font-weight: 900;
}

.messages-modal .modal-info {
    display: grid;
    gap: .5rem;
}

.messages-modal .info-item {
    display: flex;
    gap: .55rem;
    align-items: center;
    padding: .7rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
}

.messages-modal .info-item-note {
    background: #fffbeb;
    border-color: #fde68a;
}

.messages-modal .info-text {
    color: var(--mk-ink-soft, #334155);
    font-weight: 800;
}

.messages-modal .modal-footer {
    display: flex;
    gap: .65rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
}

.messages-modal .btn-modal {
    flex: 1;
    min-height: 42px;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.messages-modal .btn-delete {
    border-color: #991b1b;
    background: #991b1b;
    color: #fff;
}

.messages-modal .btn-delete.is-success {
    border-color: #059669;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

@media(max-width: 980px) {
    .messages-container {
        grid-template-columns: 1fr;
    }

    .messages-container .conversations-panel,
    .messages-container .chat-panel {
        min-height: auto;
    }

    .messages-container .chat-panel {
        min-height: 620px;
    }
}

@media(max-width: 640px) {
    .messages-container {
        width: min(100% - 1.5rem, var(--content-wide, 1400px));
        padding-top: 1rem;
    }

    .messages-container .message {
        max-width: 92%;
    }

    .messages-container .chat-input-area form {
        flex-wrap: wrap;
    }

    .messages-container .file-preview {
        order: -1;
        width: 100%;
        max-width: none;
    }

    .messages-modal .modal-footer {
        flex-direction: column;
    }
}

/* Phase 18: live chat unified layout */
.chat-page-modern {
    width: min(100% - 2rem, var(--content-wide, 1400px));
    max-width: var(--content-wide, 1400px);
    min-height: calc(100vh - 120px);
    margin: 0 auto;
    padding: 1.25rem 0 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-page-modern .rooms-header-modern {
    padding: clamp(1rem, 2.4vw, 1.35rem);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96), rgba(39, 39, 42, .98) 58%, rgba(127, 29, 29, .94));
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.chat-page-modern .rooms-header-content {
    display: grid;
    gap: .85rem;
}

.chat-page-modern .rooms-title {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.chat-page-modern .rooms-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .1);
}

.chat-page-modern .rooms-title h2 {
    margin: 0;
    font-size: clamp(1.35rem, 2.4vw, 1.75rem);
    font-weight: 900;
    letter-spacing: 0;
}

.chat-page-modern .rooms-tabs-wrapper {
    overflow-x: auto;
    padding-bottom: .15rem;
}

.chat-page-modern .rooms-tabs-scroll {
    display: flex;
    gap: .55rem;
    min-width: max-content;
}

.chat-page-modern .room-pill {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 40px;
    padding: 0 .75rem;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .86);
    font-weight: 900;
    text-decoration: none;
    animation: mkChatSlide .22s ease both;
    animation-delay: var(--stagger-delay, 0s);
}

.chat-page-modern .stagger-sm-0,
.chat-page-modern .stagger-md-0 { --stagger-delay: 0s; }
.chat-page-modern .stagger-sm-1 { --stagger-delay: .03s; }
.chat-page-modern .stagger-sm-2 { --stagger-delay: .06s; }
.chat-page-modern .stagger-sm-3 { --stagger-delay: .09s; }
.chat-page-modern .stagger-sm-4 { --stagger-delay: .12s; }
.chat-page-modern .stagger-sm-5 { --stagger-delay: .15s; }
.chat-page-modern .stagger-sm-6 { --stagger-delay: .18s; }
.chat-page-modern .stagger-sm-7 { --stagger-delay: .21s; }
.chat-page-modern .stagger-sm-8 { --stagger-delay: .24s; }
.chat-page-modern .stagger-sm-9 { --stagger-delay: .27s; }
.chat-page-modern .stagger-sm-10 { --stagger-delay: .3s; }
.chat-page-modern .stagger-md-1 { --stagger-delay: .05s; }
.chat-page-modern .stagger-md-2 { --stagger-delay: .1s; }
.chat-page-modern .stagger-md-3 { --stagger-delay: .15s; }
.chat-page-modern .stagger-md-4 { --stagger-delay: .2s; }
.chat-page-modern .stagger-md-5 { --stagger-delay: .25s; }
.chat-page-modern .stagger-md-6 { --stagger-delay: .3s; }
.chat-page-modern .stagger-md-7 { --stagger-delay: .35s; }
.chat-page-modern .stagger-md-8 { --stagger-delay: .4s; }
.chat-page-modern .stagger-md-9 { --stagger-delay: .45s; }
.chat-page-modern .stagger-md-10 { --stagger-delay: .5s; }

.chat-page-modern .room-pill:hover,
.chat-page-modern .room-pill.active {
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
}

.chat-page-modern .pill-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-page-modern .pill-count {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    min-height: 24px;
    padding: 0 .5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    font-size: .78rem;
}

.chat-page-modern .room-pill.active .pill-count,
.chat-page-modern .room-pill:hover .pill-count {
    background: #fff7f7;
}

.chat-page-modern .count-dot,
.chat-page-modern .status-indicator,
.chat-page-modern .online-dot,
.chat-page-modern .user-online-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .13);
}

.chat-page-modern .chat-layout-modern {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    min-height: 0;
    flex: 1;
}

.chat-page-modern .chat-window-modern,
.chat-page-modern .online-users-sidebar {
    min-height: 640px;
    overflow: hidden;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.chat-page-modern .chat-window-modern,
.chat-page-modern .online-users-sidebar {
    display: flex;
    flex-direction: column;
}

.chat-page-modern .chat-header-bar,
.chat-page-modern .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    padding: 1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
}

.chat-page-modern .header-bar-left,
.chat-page-modern .sidebar-header-left {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
}

.chat-page-modern .room-avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-size: 1.5rem;
    box-shadow: 0 10px 22px rgba(127, 29, 29, .18);
}

.chat-page-modern .room-info-header {
    min-width: 0;
}

.chat-page-modern .room-name,
.chat-page-modern .sidebar-header-left h3 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.08rem;
    font-weight: 900;
    letter-spacing: 0;
}

.chat-page-modern .room-status-bar {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin-top: .25rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 800;
}

.chat-page-modern .mobile-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 38px;
    padding: 0 .75rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
    cursor: pointer;
}

.chat-page-modern .toggle-badge,
.chat-page-modern .online-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 .45rem;
    border-radius: 999px;
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-size: .76rem;
    font-weight: 900;
}

.chat-page-modern .success-banner {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    font-weight: 900;
}

.chat-page-modern .chat-messages-stream {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .9rem;
    overflow-y: auto;
    padding: 1rem;
    background: #fafafa;
}

.chat-page-modern .empty-messages-state,
.chat-page-modern .no-users-state {
    display: grid;
    place-items: center;
    align-content: center;
    min-height: 220px;
    padding: 1.2rem;
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.chat-page-modern .empty-icon-circle {
    width: 86px;
    height: 86px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 50%;
    background: #fff;
    font-size: 2.3rem;
}

.chat-page-modern .empty-title {
    margin: .8rem 0 .3rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.2rem;
    font-weight: 900;
}

.chat-page-modern .empty-description,
.chat-page-modern .no-users-state p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    font-weight: 800;
}

.chat-page-modern .message-bubble {
    display: flex;
    gap: .7rem;
    max-width: min(82%, 760px);
    animation: mkChatSlide .22s ease both;
    animation-delay: var(--stagger-delay, 0s);
}

.chat-page-modern .message-bubble.message-own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-page-modern .message-avatar-link {
    flex: 0 0 auto;
    text-decoration: none;
}

.chat-page-modern .message-avatar,
.chat-page-modern .user-card-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--rank-color, #6b7280);
    color: #fff;
    font-weight: 900;
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18), 0 8px 18px rgba(24, 24, 27, .12);
}

.chat-page-modern .message-avatar {
    width: 42px;
    height: 42px;
}

.chat-page-modern .user-card-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

.chat-page-modern .message-body {
    min-width: 0;
}

.chat-page-modern .message-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
    margin-bottom: .35rem;
}

.chat-page-modern .message-own .message-meta {
    justify-content: flex-end;
}

.chat-page-modern .message-author,
.chat-page-modern .user-card-name {
    color: var(--rank-color, var(--mk-ink, #18181b));
    font-weight: 900;
    text-decoration: none;
}

.chat-page-modern .author-badge,
.chat-page-modern .user-card-role {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 .5rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-muted, #64748b);
    font-size: .74rem;
    font-weight: 900;
}

.chat-page-modern .author-badge.admin,
.chat-page-modern .user-card-role.admin {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.chat-page-modern .author-badge.mod,
.chat-page-modern .user-card-role.mod {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.chat-page-modern .message-timestamp {
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 800;
}

.chat-page-modern .message-delete-btn,
.chat-page-modern .modal-close-btn,
.chat-page-modern .modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
    cursor: pointer;
}

.chat-page-modern .message-delete-btn,
.chat-page-modern .modal-close-btn {
    min-width: 34px;
    min-height: 34px;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.chat-page-modern .message-delete-btn:hover,
.chat-page-modern .modal-close-btn:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.chat-page-modern .message-content {
    padding: .82rem .95rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    border-top-left-radius: 4px;
    background: #fff;
    color: var(--mk-ink, #18181b);
    line-height: 1.65;
    word-break: break-word;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.chat-page-modern .message-own .message-content {
    border-color: var(--mk-brand, #7f1d1d);
    border-top-left-radius: var(--mk-radius-lg, 10px);
    border-top-right-radius: 4px;
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.chat-page-modern .message-input-area {
    padding: 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
}

.chat-page-modern .input-field-wrapper {
    margin-bottom: .75rem;
}

.chat-page-modern .message-textarea,
.chat-page-modern .form-text-input {
    width: 100%;
    min-height: 46px;
    padding: .78rem .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    line-height: 1.5;
}

.chat-page-modern .message-textarea {
    max-height: 150px;
    resize: none;
}

.chat-page-modern .message-textarea:focus,
.chat-page-modern .form-text-input:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
    outline: 0;
}

.chat-page-modern .input-footer-bar,
.chat-page-modern .modal-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.chat-page-modern .char-counter {
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 900;
}

.chat-page-modern .send-message-btn,
.chat-page-modern .modal-btn.delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: 0 1rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    font-weight: 900;
    cursor: pointer;
}

.chat-page-modern .send-message-btn:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.chat-page-modern .users-list-container {
    flex: 1;
    overflow-y: auto;
    padding: .75rem;
}

.chat-page-modern .user-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: .7rem;
    min-width: 0;
    margin-bottom: .45rem;
    padding: .7rem;
    border: 1px solid transparent;
    border-radius: var(--mk-radius, 8px);
    color: var(--mk-ink, #18181b);
    text-decoration: none;
    animation: mkChatSlide .22s ease both;
    animation-delay: var(--stagger-delay, 0s);
}

.chat-page-modern .user-card:hover {
    border-color: var(--mk-line, #e4dfd7);
    background: #fff7f7;
}

.chat-page-modern .user-card-info {
    min-width: 0;
    display: grid;
    gap: .25rem;
}

.chat-page-modern .user-card-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-page-modern .user-online-indicator {
    margin-left: auto;
    flex: 0 0 auto;
}

.chat-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
}

.chat-delete-modal.active {
    display: block;
}

.chat-delete-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .62);
    backdrop-filter: blur(6px);
}

.chat-delete-modal .modal-card {
    position: relative;
    width: min(100% - 2rem, 500px);
    margin: 10vh auto 0;
    overflow: hidden;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.chat-delete-modal .modal-card-header,
.chat-delete-modal .modal-form-content {
    padding: 1rem;
}

.chat-delete-modal .modal-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
}

.chat-delete-modal .modal-title-group {
    display: flex;
    align-items: center;
    gap: .55rem;
}

.chat-delete-modal .modal-title-group h3 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.15rem;
    font-weight: 900;
}

.chat-delete-modal .form-field-group {
    display: grid;
    gap: .5rem;
    margin-bottom: 1rem;
}

.chat-delete-modal .form-label {
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
}

.chat-delete-modal .form-text-input {
    width: 100%;
    min-height: 44px;
    padding: .78rem .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
}

.chat-delete-modal .form-text-input:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
    outline: 0;
}

.chat-delete-modal .modal-actions-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.chat-delete-modal .modal-close-btn,
.chat-delete-modal .modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
    cursor: pointer;
}

.chat-delete-modal .modal-close-btn {
    min-width: 34px;
    min-height: 34px;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.chat-delete-modal .modal-close-btn:hover {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.chat-delete-modal .modal-btn {
    flex: 1;
    min-height: 42px;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.chat-delete-modal .modal-btn.delete {
    border-color: #991b1b;
    background: #991b1b;
    color: #fff;
}

@keyframes mkChatSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media(max-width: 1080px) {
    .chat-page-modern .chat-layout-modern {
        grid-template-columns: 1fr;
    }

    .chat-page-modern .online-users-sidebar {
        display: none;
    }

    .chat-page-modern .online-users-sidebar.mobile-active {
        position: fixed;
        inset: auto 1rem 1rem auto;
        z-index: 9000;
        display: flex;
        width: min(340px, calc(100vw - 2rem));
        max-height: min(620px, calc(100vh - 8rem));
    }

    .chat-page-modern .mobile-sidebar-toggle {
        display: inline-flex;
    }
}

@media(max-width: 640px) {
    .chat-page-modern {
        width: min(100% - 1.5rem, var(--content-wide, 1400px));
        padding-top: 1rem;
    }

    .chat-page-modern .chat-window-modern {
        min-height: 620px;
    }

    .chat-page-modern .chat-header-bar,
    .chat-page-modern .input-footer-bar,
    .chat-page-modern .modal-actions-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .chat-page-modern .message-bubble {
        max-width: 94%;
    }

    .chat-page-modern .send-message-btn,
    .chat-page-modern .modal-btn {
        width: 100%;
    }

    .chat-page-modern .send-text {
        display: inline;
    }
}

/* Phase 19: signals directory unified layout */
.signals-page-container {
    width: min(100% - 2rem, var(--content-wide, 1400px));
    max-width: var(--content-wide, 1400px);
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem;
}

.signals-page-container .signals-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    padding: clamp(1.1rem, 2.7vw, 1.55rem);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96), rgba(39, 39, 42, .98) 58%, rgba(127, 29, 29, .94));
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.signals-page-container .hero-bg-wave {
    display: none;
}

.signals-page-container .hero-content {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 1rem;
    align-items: center;
}

.signals-page-container .hero-title {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0;
}

.signals-page-container .hero-subtitle {
    margin: .5rem 0 0;
    color: rgba(255, 255, 255, .78);
    font-weight: 800;
}

.signals-page-container .hero-quick-stats {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .7rem .85rem;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .1);
}

.signals-page-container .quick-stat {
    min-width: 70px;
    text-align: center;
}

.signals-page-container .quick-stat-number {
    color: #fff;
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1;
}

.signals-page-container .quick-stat-label {
    margin-top: .2rem;
    color: rgba(255, 255, 255, .72);
    font-size: .72rem;
    font-weight: 900;
}

.signals-page-container .quick-stat-divider {
    width: 1px;
    align-self: stretch;
    background: rgba(255, 255, 255, .16);
}

.signals-page-container .btn-new-signal,
.signals-page-container .btn-primary-modern,
.signals-page-container .search-submit-btn,
.signals-page-container .signal-view-btn,
.signals-page-container .filter-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
    letter-spacing: 0;
    text-decoration: none;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.signals-page-container .btn-new-signal {
    padding: 0 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
}

.signals-page-container .btn-new-signal:hover {
    transform: translateY(-1px);
}

.signals-page-container .stats-container {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .8rem;
    margin-bottom: 1rem;
}

.signals-page-container .stat-card-modern {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .75rem;
    align-items: center;
    min-height: 104px;
    padding: .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.signals-page-container .stat-card-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
}

.signals-page-container .stat-card-value {
    color: var(--mk-ink, #18181b);
    font-size: 1.55rem;
    font-weight: 900;
    line-height: 1;
}

.signals-page-container .stat-card-label {
    margin-top: .25rem;
    color: var(--mk-muted, #64748b);
    font-size: .75rem;
    font-weight: 900;
}

.signals-page-container .stat-card-trend,
.signals-page-container .stat-card-badge {
    grid-column: 1 / -1;
    justify-self: start;
}

.signals-page-container .stat-card-badge,
.signals-page-container .status-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 26px;
    padding: 0 .6rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-muted, #64748b);
    font-size: .74rem;
    font-weight: 900;
}

.signals-page-container .stat-card-badge.success,
.signals-page-container .status-badge.status-tamamlandi,
.signals-page-container .status-badge.status-cozuldu {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.signals-page-container .stat-card-badge.pulse,
.signals-page-container .status-badge.status-acik {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.signals-page-container .status-badge.status-devam_ediyor,
.signals-page-container .status-badge.status-cevaplandi {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.signals-page-container .filters-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: .8rem;
    align-items: start;
    margin-bottom: 1rem;
    padding: .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.signals-page-container .filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.signals-page-container .filter-pill {
    min-height: 38px;
    padding: 0 .75rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
}

.signals-page-container .filter-pill:hover,
.signals-page-container .filter-pill.active {
    border-color: var(--mk-brand, #7f1d1d);
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
}

.signals-page-container .search-box {
    display: grid;
    gap: .45rem;
}

.signals-page-container .search-input-wrapper {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .5rem;
    align-items: center;
    min-height: 42px;
    padding: 0 .45rem 0 .75rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.signals-page-container .search-input-wrapper:focus-within {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.signals-page-container .search-input-modern {
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--mk-ink, #18181b);
    font: inherit;
    font-weight: 800;
}

.signals-page-container .search-submit-btn {
    min-height: 34px;
    padding: 0 .75rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.signals-page-container .search-clear-link {
    justify-self: end;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 900;
    text-decoration: none;
}

.signals-page-container .signals-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.signals-page-container .signal-card-modern {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    animation: mkSignalSlide .22s ease both;
    animation-delay: var(--stagger-delay, 0s);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.signals-page-container .signal-card-modern:hover {
    border-color: rgba(127, 29, 29, .28);
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(24, 24, 27, .12);
}

.signals-page-container .signal-status-bar {
    height: 4px;
    background: var(--mk-brand, #7f1d1d);
}

.signals-page-container .signal-status-bar.status-acik {
    background: #f97316;
}

.signals-page-container .signal-status-bar.status-devam_ediyor,
.signals-page-container .signal-status-bar.status-cevaplandi {
    background: #f59e0b;
}

.signals-page-container .signal-status-bar.status-tamamlandi,
.signals-page-container .signal-status-bar.status-cozuldu {
    background: #16a34a;
}

.signals-page-container .signal-status-bar.status-kapandi {
    background: #64748b;
}

.signals-page-container .signal-card-header,
.signals-page-container .signal-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .9rem 1rem;
    background: var(--mk-surface-muted, #f8fafc);
}

.signals-page-container .signal-time-badge,
.signals-page-container .author-meta {
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 900;
}

.signals-page-container .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.signals-page-container .signal-card-body {
    flex: 1;
    padding: 1rem;
}

.signals-page-container .signal-title-modern {
    margin: 0 0 .65rem;
    font-size: 1.12rem;
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: 0;
}

.signals-page-container .signal-title-modern a {
    color: var(--mk-ink, #18181b);
    text-decoration: none;
}

.signals-page-container .signal-title-modern a:hover {
    color: var(--mk-brand, #7f1d1d);
}

.signals-page-container .signal-description-modern {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.65;
}

.signals-page-container .signal-author-section {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .65rem;
}

.signals-page-container .author-avatar-wrapper {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--mk-surface-muted, #f8fafc);
}

.signals-page-container .author-avatar-img,
.signals-page-container .author-avatar-default {
    width: 100%;
    height: 100%;
}

.signals-page-container .author-avatar-img {
    object-fit: cover;
}

.signals-page-container .author-avatar-default {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--user-color, var(--mk-brand, #7f1d1d));
    color: #fff;
    font-weight: 900;
}

.signals-page-container .author-info {
    min-width: 0;
}

.signals-page-container .author-name-link {
    display: block;
    overflow: hidden;
    color: var(--user-color, var(--mk-brand, #7f1d1d));
    font-weight: 900;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.signals-page-container .signal-meta-stats {
    display: flex;
    gap: .45rem;
}

.signals-page-container .meta-stat-item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 32px;
    padding: 0 .6rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
}

.signals-page-container .signal-view-btn {
    min-height: 46px;
    margin-top: auto;
    padding: 0 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 0;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    justify-content: space-between;
}

.signals-page-container .signal-view-btn:hover {
    background: #fff7f7;
}

.signals-page-container .empty-state-modern {
    grid-column: 1 / -1;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    text-align: center;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.signals-page-container .empty-icon-bg {
    width: 76px;
    height: 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 50%;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
}

.signals-page-container .empty-title {
    margin: 0 0 .35rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.25rem;
    font-weight: 900;
}

.signals-page-container .empty-description {
    margin: 0 0 1rem;
    color: var(--mk-muted, #64748b);
    line-height: 1.65;
}

.signals-page-container .btn-primary-modern {
    padding: 0 1rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

@keyframes mkSignalSlide {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media(max-width: 1100px) {
    .signals-page-container .hero-content,
    .signals-page-container .filters-wrapper {
        grid-template-columns: 1fr;
    }

    .signals-page-container .stats-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media(max-width: 760px) {
    .signals-page-container {
        width: min(100% - 1.5rem, var(--content-wide, 1400px));
        padding-top: 1rem;
    }

    .signals-page-container .stats-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .signals-page-container .hero-quick-stats,
    .signals-page-container .signal-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .signals-page-container .btn-new-signal {
        width: 100%;
    }
}

@media(max-width: 520px) {
    .signals-page-container .stats-container,
    .signals-page-container .signals-grid-modern {
        grid-template-columns: 1fr;
    }

    .signals-page-container .search-input-wrapper {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .signals-page-container .search-submit-btn {
        grid-column: 1 / -1;
    }
}

/* Phase 20: signal detail unified layout */
.signal-detail-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.75rem !important;
}

.signal-detail-page .back-link,
.signal-detail-page .btn,
.signal-close-modal .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 42px;
    padding: 0 .95rem;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
    letter-spacing: 0;
    text-decoration: none;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.signal-detail-page .back-link {
    margin-bottom: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.signal-detail-page .back-link:hover {
    border-color: var(--mk-brand, #7f1d1d);
    background: #fff7f7;
    color: var(--mk-brand, #7f1d1d);
}

.signal-detail-page .alert {
    margin-bottom: 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    font-weight: 900;
}

.signal-detail-page .alert-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.signal-detail-page .alert-error,
.signal-detail-page .btn-danger,
.signal-detail-page .btn-close,
.signal-close-modal .btn-danger {
    border-color: #991b1b;
    background: #991b1b;
    color: #fff;
}

.signal-detail-page .alert-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.signal-detail-page .alert-info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.signal-detail-page .signal-detail,
.signal-detail-page .replies-section,
.signal-detail-page .reply-form {
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.signal-detail-page .signal-detail {
    position: relative;
}

.signal-detail-page .signal-detail::before,
.signal-detail-page .reply-form::before {
    content: "";
    display: block;
    height: 4px;
    background: var(--mk-brand, #7f1d1d);
}

.signal-detail-page .signal-header,
.signal-detail-page .signal-meta,
.signal-detail-page .signal-content,
.signal-detail-page .signal-close-section,
.signal-detail-page .signal-closed-notice {
    padding: 1rem;
}

.signal-detail-page .signal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: var(--mk-surface-muted, #f8fafc);
}

.signal-detail-page .signal-header h1 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: clamp(1.45rem, 2.6vw, 2.15rem);
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: 0;
}

.signal-detail-page .signal-status {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 .75rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    color: var(--mk-muted, #64748b);
    font-size: .8rem;
    font-weight: 900;
    white-space: nowrap;
}

.signal-detail-page .signal-status.status-acik {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.signal-detail-page .signal-status.status-devam_ediyor,
.signal-detail-page .signal-status.status-cevaplandi {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.signal-detail-page .signal-status.status-tamamlandi,
.signal-detail-page .signal-status.status-cozuldu {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.signal-detail-page .signal-status.status-kapandi {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #475569;
}

.signal-detail-page .signal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    color: var(--mk-muted, #64748b);
    font-size: .88rem;
    font-weight: 900;
}

.signal-detail-page .signal-meta span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.signal-detail-page .signal-author-link,
.signal-detail-page .reply-author-link {
    color: var(--user-color, var(--mk-brand, #7f1d1d));
    font-weight: 900;
    text-decoration: none;
}

.signal-detail-page .signal-content,
.signal-detail-page .reply-content {
    color: var(--mk-ink-soft, #334155);
    line-height: 1.75;
    word-break: break-word;
}

.signal-detail-page .signal-content {
    font-size: 1rem;
}

.signal-detail-page .signal-close-section,
.signal-detail-page .signal-closed-notice {
    margin: 1rem;
    border: 1px solid #fde68a;
    border-radius: var(--mk-radius, 8px);
    background: #fffbeb;
}

.signal-detail-page .signal-closed-notice {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.signal-detail-page .close-helper-text,
.signal-close-modal .modal-helper-text,
.signal-detail-page .form-help-text,
.signal-close-modal .form-help-text {
    margin: 0 0 .75rem;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
    font-weight: 800;
}

.signal-detail-page .signal-closed-notice strong {
    display: block;
    margin-bottom: .35rem;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.signal-detail-page .signal-closed-notice p {
    margin: 0;
    color: var(--mk-muted, #64748b);
}

.signal-detail-page .replies-section,
.signal-detail-page .reply-form {
    padding: 1rem;
}

.signal-detail-page .replies-section h2,
.signal-detail-page .reply-form h3 {
    margin: 0 0 1rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.18rem;
    font-weight: 900;
    letter-spacing: 0;
}

.signal-detail-page .no-replies {
    padding: 1.4rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-muted, #64748b);
    text-align: center;
    font-weight: 900;
}

.signal-detail-page .reply {
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
}

.signal-detail-page .reply + .reply {
    margin-top: .75rem;
}

.signal-detail-page .reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}

.signal-detail-page .reply-author {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
    gap: .55rem;
}

.signal-detail-page .reply-avatar {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 50%;
    object-fit: cover;
}

.signal-detail-page .author-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 .55rem;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    background: #f0fdf4;
    color: #166534;
    font-size: .74rem;
    font-weight: 900;
}

.signal-detail-page .reply-time {
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 900;
    white-space: nowrap;
}

.signal-detail-page .form-group,
.signal-close-modal .form-group {
    display: grid;
    gap: .5rem;
    margin-bottom: 1rem;
}

.signal-detail-page label,
.signal-close-modal label {
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
}

.signal-detail-page textarea,
.signal-close-modal textarea,
.signal-close-modal .form-control,
.signal-close-modal select {
    width: 100%;
    min-height: 44px;
    padding: .8rem .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    line-height: 1.55;
}

.signal-detail-page textarea,
.signal-close-modal textarea {
    min-height: 120px;
    resize: vertical;
}

.signal-detail-page textarea:focus,
.signal-close-modal textarea:focus,
.signal-close-modal .form-control:focus,
.signal-close-modal select:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
    outline: 0;
}

.signal-detail-page .btn-primary {
    border: 1px solid var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.signal-detail-page .btn-secondary,
.signal-close-modal .btn-secondary {
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.signal-close-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    padding: 1rem;
    overflow-y: auto;
    background: rgba(15, 23, 42, .62);
    backdrop-filter: blur(6px);
}

.signal-close-modal .modal-content {
    position: relative;
    width: min(100%, 560px);
    margin: 7vh auto;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.signal-close-modal .close {
    position: absolute;
    top: .85rem;
    right: .85rem;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: 900;
}

.signal-close-modal h2 {
    margin: 0 2.4rem .65rem 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0;
}

.signal-close-modal .modal-actions {
    display: flex;
    gap: .65rem;
}

.signal-close-modal .modal-actions .btn {
    flex: 1;
}

@media(max-width: 760px) {
    .signal-detail-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .signal-detail-page .signal-header,
    .signal-detail-page .reply-header,
    .signal-close-modal .modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .signal-detail-page .signal-status,
    .signal-detail-page .btn,
    .signal-close-modal .btn {
        width: 100%;
    }
}

/* Phase 21: new signal form unified layout */
.new-signal-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.new-signal-page .signal-container,
.new-signal-page .signal-wrapper {
    width: min(100%, 960px);
    margin: 0 auto;
}

.new-signal-page .signal-wrapper {
    display: grid;
    gap: 1rem;
}

.new-signal-page .signal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.new-signal-page .header-content {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: .85rem;
}

.new-signal-page .header-icon,
.new-signal-page .info-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(127, 29, 29, .2);
    border-radius: var(--mk-radius, 8px);
    background: #fef2f2;
    color: var(--mk-brand, #7f1d1d);
    font-size: 1.25rem;
}

.new-signal-page .header-text {
    min-width: 0;
}

.new-signal-page .header-text h1 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: clamp(1.45rem, 2.4vw, 2rem);
    font-weight: 900;
    letter-spacing: 0;
}

.new-signal-page .header-text p {
    margin: .2rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .95rem;
    line-height: 1.5;
}

.new-signal-page .back-button,
.new-signal-page .submit-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.new-signal-page .back-button {
    flex: 0 0 auto;
    padding: .72rem .95rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.new-signal-page .back-button:hover {
    border-color: rgba(127, 29, 29, .32);
    background: #fff7ed;
    color: var(--mk-brand, #7f1d1d);
    transform: translateY(-1px);
}

.new-signal-page .error-alert,
.new-signal-page .info-card,
.new-signal-page .warning-box,
.new-signal-page .signal-form-card {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.new-signal-page .error-alert,
.new-signal-page .info-card,
.new-signal-page .warning-box {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .95rem 1rem;
}

.new-signal-page .error-alert {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 850;
}

.new-signal-page .info-card {
    border-color: #dbeafe;
    background: #eff6ff;
}

.new-signal-page .info-content h3,
.new-signal-page .warning-box strong {
    margin: 0 0 .25rem;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 900;
}

.new-signal-page .info-content p,
.new-signal-page .warning-box p {
    margin: 0;
    color: var(--mk-ink-soft, #334155);
    line-height: 1.6;
}

.new-signal-page .signal-form-card {
    padding: 1.1rem;
}

.new-signal-page .signal-form {
    display: grid;
    gap: 1rem;
}

.new-signal-page .input-group {
    display: grid;
    gap: .5rem;
}

.new-signal-page .input-label {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.new-signal-page .required-star {
    color: #dc2626;
}

.new-signal-page .optional-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 .55rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #f8fafc;
    color: var(--mk-muted, #64748b);
    font-size: .74rem;
    font-weight: 900;
}

.new-signal-page .custom-input,
.new-signal-page .custom-textarea {
    width: 100%;
    min-height: 46px;
    padding: .82rem .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    line-height: 1.55;
    outline: 0;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.new-signal-page .custom-textarea {
    min-height: 190px;
    resize: vertical;
}

.new-signal-page .custom-input:focus,
.new-signal-page .custom-textarea:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.new-signal-page .custom-input::placeholder,
.new-signal-page .custom-textarea::placeholder {
    color: #94a3b8;
}

.new-signal-page .helper-text {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
    line-height: 1.45;
}

.new-signal-page .helper-text svg,
.new-signal-page .warning-box svg,
.new-signal-page .error-alert svg {
    flex: 0 0 auto;
    margin-top: .1rem;
}

.new-signal-page .similar-suggestions {
    display: grid;
    gap: .55rem;
}

.new-signal-page .warning-box {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.new-signal-page .form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: .25rem;
}

.new-signal-page .submit-button {
    min-width: 210px;
    padding: .86rem 1.15rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(127, 29, 29, .18);
}

.new-signal-page .submit-button:hover {
    background: #991b1b;
    border-color: #991b1b;
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(127, 29, 29, .22);
}

.new-signal-page .submit-button:active {
    transform: translateY(0);
}

.new-signal-page .submit-button:disabled {
    cursor: not-allowed;
    opacity: .7;
    transform: none;
    box-shadow: none;
}

.new-signal-page .back-button:focus-visible,
.new-signal-page .submit-button:focus-visible,
.new-signal-page .custom-input:focus-visible,
.new-signal-page .custom-textarea:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@media(max-width: 760px) {
    .new-signal-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .new-signal-page .signal-header,
    .new-signal-page .header-content,
    .new-signal-page .info-card,
    .new-signal-page .warning-box,
    .new-signal-page .error-alert {
        align-items: stretch;
        flex-direction: column;
    }

    .new-signal-page .back-button,
    .new-signal-page .submit-button {
        width: 100%;
    }

    .new-signal-page .form-actions {
        justify-content: stretch;
    }
}

@media(max-width: 520px) {
    .new-signal-page .signal-header,
    .new-signal-page .signal-form-card,
    .new-signal-page .info-card,
    .new-signal-page .warning-box,
    .new-signal-page .error-alert {
        padding: .9rem;
    }

    .new-signal-page .header-icon,
    .new-signal-page .info-icon {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }
}

/* Phase 22: cetele and personal archive unified layout */
.cetele-page-container {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.cetele-page-container .cetele-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 1rem;
    min-height: 220px;
    padding: 1.45rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: linear-gradient(135deg, #3f1717 0%, #7f1d1d 54%, #1f2937 100%);
    color: #fff;
    box-shadow: 0 18px 48px rgba(31, 41, 55, .18);
}

.cetele-page-container .hero-bg-dots {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,.16) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: .45;
}

.cetele-page-container .hero-content {
    position: relative;
    z-index: 1;
    min-height: calc(220px - 2.9rem);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 1.25rem;
}

.cetele-page-container .hero-left {
    justify-self: start;
    align-self: center;
    text-align: left;
    max-width: 640px;
}

.cetele-page-container .hero-title {
    margin: 0;
    color: #fff;
    font-size: clamp(1.9rem, 3vw, 2.8rem);
    font-weight: 950;
    letter-spacing: 0;
}

.cetele-page-container .hero-subtitle {
    margin: .4rem 0 0;
    color: rgba(255,255,255,.78);
    line-height: 1.55;
}

.cetele-page-container .hero-progress {
    display: flex;
    align-items: center;
    gap: .85rem;
}

.cetele-page-container .progress-circle {
    width: 84px;
    height: 84px;
}

.cetele-page-container .progress-circle svg {
    width: 84px;
    height: 84px;
}

.cetele-page-container .progress-label {
    color: rgba(255,255,255,.75);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.cetele-page-container .hero-actions,
.cetele-page-container .generated-documents-links,
.cetele-page-container .generated-document-actions,
.cetele-page-container .task-actions-group {
    display: flex;
    align-items: center;
    gap: .6rem;
}

.cetele-page-container .btn-hero-secondary,
.cetele-page-container .btn-hero-primary,
.cetele-page-container .personal-archive-head a,
.cetele-page-container .generated-documents-links a,
.cetele-page-container .generated-document-actions a,
.cetele-page-container .archive-note-form button,
.cetele-page-container .btn-filter-modern,
.cetele-page-container .btn-clear-modern,
.cetele-page-container .btn-empty-action {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .72rem .95rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.cetele-page-container .btn-hero-secondary,
.cetele-page-container .generated-documents-links a:first-child,
.cetele-page-container .personal-archive-head a {
    border-color: rgba(255,255,255,.28);
    background: rgba(255,255,255,.12);
    color: #fff;
}

.cetele-page-container .personal-archive-head a,
.cetele-page-container .generated-documents-links a:first-child {
    border-color: var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.cetele-page-container .btn-hero-secondary:hover,
.cetele-page-container .btn-hero-primary:hover,
.cetele-page-container .personal-archive-head a:hover,
.cetele-page-container .generated-documents-links a:hover,
.cetele-page-container .generated-document-actions a:hover,
.cetele-page-container .archive-note-form button:hover,
.cetele-page-container .btn-filter-modern:hover,
.cetele-page-container .btn-empty-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(127, 29, 29, .16);
}

.cetele-page-container .btn-hero-primary {
    border-color: #fff;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
}

.cetele-page-container .archive-focus-grid,
.cetele-page-container .stats-grid-modern,
.cetele-page-container .archive-summary-row {
    display: grid;
    gap: .85rem;
}

.cetele-page-container .archive-focus-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 1rem 0;
}

.cetele-page-container .archive-focus-card,
.cetele-page-container .generated-documents-panel,
.cetele-page-container .personal-archive-panel,
.cetele-page-container .filters-container-modern,
.cetele-page-container .stat-card-cetele,
.cetele-page-container .task-card-modern,
.cetele-page-container .empty-state-cetele {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.cetele-page-container .archive-focus-card {
    padding: 1rem;
}

.cetele-page-container .archive-focus-card strong,
.cetele-page-container .generated-documents-head h2,
.cetele-page-container .personal-archive-head h2,
.cetele-page-container .archive-note-box h3,
.cetele-page-container .archive-list-box h3,
.cetele-page-container .task-title-modern,
.cetele-page-container .empty-title {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-weight: 950;
    letter-spacing: 0;
}

.cetele-page-container .archive-focus-card span,
.cetele-page-container .generated-documents-head p,
.cetele-page-container .personal-archive-head p,
.cetele-page-container .generated-document-card span,
.cetele-page-container .generated-documents-empty span,
.cetele-page-container .task-description-modern,
.cetele-page-container .empty-description,
.cetele-page-container .archive-empty-state,
.cetele-page-container .meta-item {
    color: var(--mk-muted, #64748b);
    line-height: 1.6;
}

.cetele-page-container .archive-save-alert {
    margin: 1rem 0;
    padding: .9rem 1rem;
    border: 1px solid #bbf7d0;
    border-radius: var(--mk-radius, 8px);
    background: #ecfdf5;
    color: #166534;
    font-weight: 900;
}

.cetele-page-container .archive-save-alert.is-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.cetele-page-container .generated-documents-panel,
.cetele-page-container .personal-archive-panel,
.cetele-page-container .filters-container-modern {
    margin: 1rem 0;
    padding: 1rem;
}

.cetele-page-container .generated-documents-head,
.cetele-page-container .personal-archive-head,
.cetele-page-container .generated-document-card,
.cetele-page-container .archive-note-card,
.cetele-page-container .archive-saved-card,
.cetele-page-container .task-card-header,
.cetele-page-container .task-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
}

.cetele-page-container .generated-document-list,
.cetele-page-container .archive-note-list,
.cetele-page-container .archive-saved-list,
.cetele-page-container .archive-note-form {
    display: grid;
    gap: .65rem;
}

.cetele-page-container .generated-document-card,
.cetele-page-container .generated-documents-empty,
.cetele-page-container .archive-note-box,
.cetele-page-container .archive-list-box,
.cetele-page-container .archive-empty-state {
    padding: .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #f8fafc;
}

.cetele-page-container .generated-document-badge,
.cetele-page-container .stat-card-badge,
.cetele-page-container .task-category-badge,
.cetele-page-container .task-status-badge,
.cetele-page-container .task-date-badge {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .6rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.cetele-color-ef4444 { --category-color: #ef4444; }
.cetele-color-f59e0b { --category-color: #f59e0b; }
.cetele-color-eab308 { --category-color: #eab308; }
.cetele-color-10b981 { --category-color: #10b981; }
.cetele-color-3b82f6 { --category-color: #3b82f6; }
.cetele-color-8b5cf6 { --category-color: #8b5cf6; }
.cetele-color-ec4899 { --category-color: #ec4899; }
.cetele-color-6b7280 { --category-color: #6b7280; }
.cetele-color-667eea { --category-color: #667eea; }
.cetele-color-14b8a6 { --category-color: #14b8a6; }
.cetele-color-f97316 { --category-color: #f97316; }
.cetele-color-84cc16 { --category-color: #84cc16; }
.cetele-color-06b6d4 { --category-color: #06b6d4; }
.cetele-color-a855f7 { --category-color: #a855f7; }
.cetele-color-f43f5e { --category-color: #f43f5e; }
.cetele-color-64748b { --category-color: #64748b; }

.cetele-page-container .generated-document-badge {
    border: 1px solid #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.cetele-page-container .archive-summary-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 1rem 0;
}

.cetele-page-container .archive-summary-row span {
    padding: .85rem;
    border: 1px solid #bbf7d0;
    border-radius: var(--mk-radius, 8px);
    background: #ecfdf5;
    color: #166534;
    font-weight: 850;
}

.cetele-page-container .archive-summary-row strong {
    display: block;
    font-size: 1.35rem;
    font-weight: 950;
}

.cetele-page-container .personal-archive-grid {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr) minmax(0, 1fr);
    gap: .85rem;
    align-items: start;
}

.cetele-page-container .archive-note-form input[type="text"],
.cetele-page-container .archive-note-form select,
.cetele-page-container .archive-note-form textarea,
.cetele-page-container .search-input-cetele,
.cetele-page-container .filter-select-modern {
    width: 100%;
    min-height: 44px;
    padding: .78rem .85rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    outline: 0;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.cetele-page-container .archive-note-form textarea {
    min-height: 120px;
    resize: vertical;
}

.cetele-page-container .archive-note-form input[type="text"]:focus,
.cetele-page-container .archive-note-form select:focus,
.cetele-page-container .archive-note-form textarea:focus,
.cetele-page-container .search-input-cetele:focus,
.cetele-page-container .filter-select-modern:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.cetele-page-container .archive-pin-check {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--mk-ink-soft, #334155);
    font-weight: 850;
}

.cetele-page-container .archive-note-card,
.cetele-page-container .archive-saved-card {
    align-items: flex-start;
    padding: .8rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.cetele-page-container .archive-note-card span,
.cetele-page-container .archive-saved-card span {
    display: block;
    margin-bottom: .25rem;
    color: var(--mk-brand, #7f1d1d);
    font-size: .74rem;
    font-weight: 900;
    text-transform: uppercase;
}

.cetele-page-container .archive-note-card strong,
.cetele-page-container .archive-saved-card a,
.cetele-page-container .generated-document-card strong,
.cetele-page-container .generated-documents-empty strong {
    display: block;
    color: var(--mk-ink, #18181b);
    font-weight: 950;
    text-decoration: none;
}

.cetele-page-container .archive-note-card p {
    margin: .35rem 0 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
    white-space: pre-wrap;
}

.cetele-page-container .archive-note-card button,
.cetele-page-container .archive-saved-card button {
    min-height: 34px;
    padding: .45rem .65rem;
    border: 1px solid #fecaca;
    border-radius: var(--mk-radius, 8px);
    background: #fef2f2;
    color: #991b1b;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    white-space: nowrap;
}

.cetele-page-container .stats-grid-modern {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 1rem 0;
}

.cetele-page-container .stat-card-cetele {
    position: relative;
    overflow: hidden;
    min-height: 132px;
    padding: 1rem;
}

.cetele-page-container .stat-card-cetele::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--stat-color, var(--mk-brand, #7f1d1d));
}

.cetele-page-container .stat-card-cetele.total {
    --stat-color: #64748b;
}

.cetele-page-container .stat-card-cetele.completed {
    --stat-color: #16a34a;
}

.cetele-page-container .stat-card-cetele.progress {
    --stat-color: #2563eb;
}

.cetele-page-container .stat-card-cetele.pending {
    --stat-color: #d97706;
}

.cetele-page-container .stat-card-icon {
    font-size: 1.65rem;
}

.cetele-page-container .stat-card-value {
    margin: .45rem 0 .2rem;
    color: var(--mk-ink, #18181b);
    font-size: 2rem;
    font-weight: 950;
    line-height: 1;
}

.cetele-page-container .stat-card-label {
    color: var(--mk-muted, #64748b);
    font-size: .8rem;
    font-weight: 900;
    text-transform: uppercase;
}

.cetele-page-container .stat-card-badge {
    position: absolute;
    top: .8rem;
    right: .8rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.cetele-page-container .stat-card-badge.success {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.cetele-page-container .stat-card-badge.active {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.cetele-page-container .stat-card-badge.warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.cetele-page-container .stat-card-bg-pattern {
    display: none;
}

.cetele-page-container .filter-form-modern {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(180px, 1fr) minmax(180px, 1fr) auto auto;
    gap: .75rem;
    align-items: center;
}

.cetele-page-container .filter-search-group,
.cetele-page-container .filter-select-group {
    position: relative;
}

.cetele-page-container .search-icon-inner,
.cetele-page-container .select-icon {
    position: absolute;
    left: .85rem;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
    color: var(--mk-muted, #64748b);
    pointer-events: none;
}

.cetele-page-container .search-input-cetele,
.cetele-page-container .filter-select-modern {
    padding-left: 2.55rem;
}

.cetele-page-container .btn-clear-modern {
    width: 44px;
    padding: 0;
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.cetele-page-container .tasks-grid-modern {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.cetele-page-container .task-card-modern {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.cetele-page-container .task-card-modern::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--task-color, #2563eb);
}

.cetele-page-container .task-card-modern.status-tamamlandi {
    --task-color: #16a34a;
}

.cetele-page-container .task-card-modern.status-devam_ediyor {
    --task-color: #2563eb;
}

.cetele-page-container .task-card-modern.status-beklemede {
    --task-color: #d97706;
}

.cetele-page-container .task-card-modern:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 18px 40px rgba(15, 23, 42, .12);
    transform: translateY(-2px);
}

.cetele-page-container .task-status-indicator {
    display: none;
}

.cetele-page-container .task-card-header,
.cetele-page-container .task-card-body,
.cetele-page-container .task-card-footer {
    padding: 1rem 1rem 0 1.15rem;
}

.cetele-page-container .task-card-footer {
    padding-bottom: 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
    background: #f8fafc;
}

.cetele-page-container .task-badges-group,
.cetele-page-container .task-meta-info {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.cetele-page-container .task-category-badge {
    border: 1px solid color-mix(in srgb, var(--category-color, #64748b) 38%, #fff);
    background: color-mix(in srgb, var(--category-color, #64748b) 12%, #fff);
    color: var(--category-color, #475569);
}

.cetele-page-container .task-status-badge.status-tamamlandi {
    border: 1px solid #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.cetele-page-container .task-status-badge.status-devam_ediyor {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.cetele-page-container .task-status-badge.status-beklemede,
.cetele-page-container .task-date-badge {
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.cetele-page-container .task-title-modern {
    font-size: 1.12rem;
    line-height: 1.35;
}

.cetele-page-container .task-description-modern {
    margin: .55rem 0 0;
}

.cetele-page-container .read-more-link {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
}

.cetele-page-container .task-action-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.cetele-page-container .task-action-btn:hover {
    transform: translateY(-1px);
}

.cetele-page-container .task-action-btn.edit:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.cetele-page-container .task-action-btn.complete:hover {
    border-color: #bbf7d0;
    background: #ecfdf5;
}

.cetele-page-container .task-action-btn.delete:hover {
    border-color: #fecaca;
    background: #fef2f2;
}

.cetele-page-container .empty-state-cetele {
    grid-column: 1 / -1;
    padding: 3rem 1rem;
    text-align: center;
}

.cetele-page-container .empty-circle {
    width: 92px;
    height: 92px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border: 1px solid #f5d0d0;
    border-radius: 999px;
    background: #fef2f2;
    color: var(--mk-brand, #7f1d1d);
    font-size: 2.6rem;
}

.cetele-page-container .btn-hero-secondary:focus-visible,
.cetele-page-container .btn-hero-primary:focus-visible,
.cetele-page-container .personal-archive-head a:focus-visible,
.cetele-page-container .generated-documents-links a:focus-visible,
.cetele-page-container .generated-document-actions a:focus-visible,
.cetele-page-container .archive-note-form button:focus-visible,
.cetele-page-container .archive-note-card button:focus-visible,
.cetele-page-container .archive-saved-card button:focus-visible,
.cetele-page-container .btn-filter-modern:focus-visible,
.cetele-page-container .btn-clear-modern:focus-visible,
.cetele-page-container .btn-empty-action:focus-visible,
.cetele-page-container .task-action-btn:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@supports not (background: color-mix(in srgb, #000 10%, #fff)) {
    .cetele-page-container .task-category-badge {
        border-color: var(--mk-line, #e4dfd7);
        background: #f8fafc;
        color: var(--mk-ink-soft, #334155);
    }
}

@media(max-width: 1200px) {
    .cetele-page-container .personal-archive-grid {
        grid-template-columns: 1fr;
    }

    .cetele-page-container .stats-grid-modern {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media(max-width: 960px) {
    .cetele-page-container .hero-content,
    .cetele-page-container .filter-form-modern {
        grid-template-columns: 1fr;
    }

    .cetele-page-container .hero-actions,
    .cetele-page-container .hero-progress {
        justify-content: flex-start;
    }

    .cetele-page-container .archive-focus-grid,
    .cetele-page-container .archive-summary-row {
        grid-template-columns: 1fr;
    }
}

@media(max-width: 760px) {
    .cetele-page-container {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .cetele-page-container .generated-documents-head,
    .cetele-page-container .personal-archive-head,
    .cetele-page-container .generated-document-card,
    .cetele-page-container .archive-note-card,
    .cetele-page-container .archive-saved-card,
    .cetele-page-container .task-card-header,
    .cetele-page-container .task-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .cetele-page-container .hero-actions,
    .cetele-page-container .generated-documents-links,
    .cetele-page-container .generated-document-actions,
    .cetele-page-container .task-actions-group {
        flex-wrap: wrap;
    }

    .cetele-page-container .stats-grid-modern,
    .cetele-page-container .tasks-grid-modern {
        grid-template-columns: 1fr;
    }

    .cetele-page-container .btn-hero-secondary,
    .cetele-page-container .btn-hero-primary,
    .cetele-page-container .personal-archive-head a,
    .cetele-page-container .generated-documents-links a,
    .cetele-page-container .btn-filter-modern,
    .cetele-page-container .btn-empty-action {
        width: 100%;
    }
}

@media(max-width: 520px) {
    .cetele-page-container .cetele-hero,
    .cetele-page-container .generated-documents-panel,
    .cetele-page-container .personal-archive-panel,
    .cetele-page-container .filters-container-modern {
        padding: 1rem;
    }

    .cetele-page-container .progress-circle,
    .cetele-page-container .progress-circle svg {
        width: 72px;
        height: 72px;
    }
}

/* Phase 23: cetele detail unified layout */
.cetele-view-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.cetele-view-page .cetele-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.cetele-view-page .header-left h1 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: clamp(1.45rem, 2.4vw, 2rem);
    font-weight: 950;
    letter-spacing: 0;
}

.cetele-view-page .header-left p {
    margin: .25rem 0 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.cetele-view-page .btn-back,
.cetele-view-page .btn-action,
.cetele-view-page .btn-add-file,
.cetele-view-page .btn-file-action,
.cetele-delete-modal .btn-modal-cancel,
.cetele-delete-modal .btn-modal-delete {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .68rem .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.cetele-view-page .btn-back:hover,
.cetele-view-page .btn-action:hover,
.cetele-view-page .btn-add-file:hover,
.cetele-view-page .btn-file-action:hover,
.cetele-delete-modal .btn-modal-cancel:hover,
.cetele-delete-modal .btn-modal-delete:hover {
    transform: translateY(-1px);
}

.cetele-view-page .btn-success,
.cetele-view-page .btn-add-file,
.cetele-delete-modal .btn-modal-delete {
    border-color: #16a34a;
    background: #16a34a;
    color: #fff;
}

.cetele-view-page .btn-success:hover,
.cetele-view-page .btn-add-file:hover {
    border-color: #15803d;
    background: #15803d;
}

.cetele-view-page .btn-warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.cetele-view-page .btn-edit,
.cetele-view-page .btn-download {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.cetele-view-page .btn-delete,
.cetele-view-page .btn-file-delete,
.cetele-delete-modal .btn-modal-delete {
    border-color: #dc2626;
    background: #dc2626;
    color: #fff;
}

.cetele-view-page .btn-delete:hover,
.cetele-view-page .btn-file-delete:hover,
.cetele-delete-modal .btn-modal-delete:hover {
    border-color: #b91c1c;
    background: #b91c1c;
}

.cetele-view-page .view-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 1rem;
    align-items: start;
}

.cetele-view-page .cetele-card,
.cetele-view-page .files-card {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.cetele-view-page .cetele-card {
    padding: 1rem;
}

.cetele-view-page .files-card {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    padding: 1rem;
    overflow: auto;
}

.cetele-view-page .card-header-section,
.cetele-view-page .meta-section,
.cetele-view-page .target-date,
.cetele-view-page .file-item,
.cetele-view-page .file-actions,
.cetele-view-page .files-footer,
.cetele-view-page .actions-section,
.cetele-view-page .badges-section {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.cetele-view-page .card-header-section,
.cetele-view-page .file-item,
.cetele-view-page .files-footer {
    justify-content: space-between;
}

.cetele-view-page .actions-section,
.cetele-view-page .badges-section {
    flex-wrap: wrap;
}

.cetele-view-page .inline-action-form {
    display: inline-flex;
}

.cetele-view-page .badge-kategori,
.cetele-view-page .badge-durum,
.cetele-view-page .badge-info,
.cetele-view-page .badge-danger,
.cetele-view-page .badge-warning {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .36rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.cetele-view-page .badge-kategori {
    border: 1px solid color-mix(in srgb, var(--category-color, #64748b) 38%, #fff);
    background: color-mix(in srgb, var(--category-color, #64748b) 12%, #fff);
    color: var(--category-color, #475569);
}

.cetele-view-page .badge-success {
    border: 1px solid #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.cetele-view-page .badge-primary,
.cetele-view-page .badge-info {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.cetele-view-page .badge-warning {
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.cetele-view-page .badge-danger {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.cetele-view-page .cetele-title {
    margin: 1rem 0;
    color: var(--mk-ink, #18181b);
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    font-weight: 950;
    line-height: 1.25;
    letter-spacing: 0;
}

.cetele-view-page .content-box {
    margin-top: 1rem;
    padding: .95rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #f8fafc;
}

.cetele-view-page .content-box h5,
.cetele-view-page .files-card h3 {
    margin: 0 0 .65rem;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 950;
    letter-spacing: 0;
}

.cetele-view-page .cetele-content {
    color: var(--mk-ink-soft, #334155);
    line-height: 1.75;
}

.cetele-view-page .cetele-content p {
    margin: 0 0 .75rem;
}

.cetele-view-page .cetele-content p:last-child {
    margin-bottom: 0;
}

.cetele-view-page .target-date {
    flex-wrap: wrap;
    margin: 0;
    color: var(--mk-ink-soft, #334155);
}

.cetele-view-page .meta-section {
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
}

.cetele-view-page .meta-item {
    padding: .55rem .7rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-muted, #64748b);
}

.cetele-view-page .files-card h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cetele-view-page .empty-files {
    padding: 2rem 1rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #f8fafc;
    text-align: center;
}

.cetele-view-page .empty-icon {
    width: 72px;
    height: 72px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .75rem;
    border: 1px solid #f5d0d0;
    border-radius: 999px;
    background: #fef2f2;
    color: var(--mk-brand, #7f1d1d);
    font-size: 2rem;
}

.cetele-view-page .empty-files p {
    margin: 0 0 1rem;
    color: var(--mk-muted, #64748b);
}

.cetele-view-page .files-list {
    display: grid;
    gap: .7rem;
}

.cetele-view-page .file-item {
    padding: .75rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #f8fafc;
}

.cetele-view-page .file-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #bfdbfe;
    border-radius: var(--mk-radius, 8px);
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 1.25rem;
}

.cetele-view-page .file-info {
    min-width: 0;
    flex: 1;
}

.cetele-view-page .file-name {
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cetele-view-page .file-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .2rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
}

.cetele-view-page .btn-file-action {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
}

.cetele-view-page .alert {
    margin: 1rem 0;
    padding: .9rem 1rem;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
}

.cetele-view-page .alert-success {
    border: 1px solid #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.cetele-view-page .alert-error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.cetele-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, .62);
    backdrop-filter: blur(6px);
}

.cetele-delete-modal[hidden] {
    display: none !important;
}

.cetele-delete-modal .modal-box {
    width: min(100%, 540px);
    overflow: hidden;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.cetele-delete-modal .modal-header-danger {
    padding: 1rem;
    border-bottom: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.cetele-delete-modal .modal-header-danger h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 950;
}

.cetele-delete-modal .modal-body {
    padding: 1rem;
}

.cetele-delete-modal .modal-body p {
    margin: 0 0 .75rem;
    color: var(--mk-ink-soft, #334155);
    line-height: 1.6;
}

.cetele-delete-modal .modal-body p:last-child {
    margin-bottom: 0;
}

.cetele-delete-modal .text-danger {
    color: #991b1b;
    font-weight: 900;
}

.cetele-delete-modal .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    padding: 1rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
    background: #f8fafc;
}

@supports not (background: color-mix(in srgb, #000 10%, #fff)) {
    .cetele-view-page .badge-kategori {
        border-color: var(--mk-line, #e4dfd7);
        background: #f8fafc;
        color: var(--mk-ink-soft, #334155);
    }
}

@media(max-width: 1080px) {
    .cetele-view-page .view-grid {
        grid-template-columns: 1fr;
    }

    .cetele-view-page .files-card {
        position: static;
        max-height: none;
    }
}

@media(max-width: 760px) {
    .cetele-view-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .cetele-view-page .cetele-header,
    .cetele-view-page .card-header-section,
    .cetele-view-page .file-item,
    .cetele-view-page .files-footer,
    .cetele-delete-modal .modal-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .cetele-view-page .actions-section,
    .cetele-view-page .inline-action-form,
    .cetele-view-page .btn-back,
    .cetele-view-page .btn-action,
    .cetele-view-page .btn-add-file,
    .cetele-delete-modal .btn-modal-cancel,
    .cetele-delete-modal .btn-modal-delete {
        width: 100%;
    }

    .cetele-view-page .file-actions {
        justify-content: flex-end;
    }
}

@media print {
    .cetele-view-page .cetele-header,
    .cetele-view-page .actions-section,
    .cetele-view-page .files-footer,
    .cetele-view-page .file-actions,
    .cetele-delete-modal {
        display: none !important;
    }

    .cetele-view-page .view-grid {
        grid-template-columns: 1fr;
    }

    .cetele-view-page .cetele-card,
    .cetele-view-page .files-card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* Phase 24: cetele create/edit form unified layout */
.cetele-form-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.cetele-form-page .cetele-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.cetele-form-page .header-left h1 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: clamp(1.45rem, 2.4vw, 2rem);
    font-weight: 950;
    letter-spacing: 0;
}

.cetele-form-page .header-left p {
    margin: .25rem 0 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.cetele-form-page .btn-back,
.cetele-form-page .btn-submit,
.cetele-form-page .btn-cancel {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .76rem 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.cetele-form-page .btn-back:hover,
.cetele-form-page .btn-submit:hover,
.cetele-form-page .btn-cancel:hover {
    transform: translateY(-1px);
}

.cetele-form-page .btn-submit {
    min-width: 180px;
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    box-shadow: 0 14px 32px rgba(127, 29, 29, .16);
}

.cetele-form-page .btn-submit:hover {
    border-color: #991b1b;
    background: #991b1b;
}

.cetele-form-page .btn-cancel:hover,
.cetele-form-page .btn-back:hover {
    border-color: rgba(127, 29, 29, .32);
    background: #fff7ed;
    color: var(--mk-brand, #7f1d1d);
}

.cetele-form-page .alert {
    margin: 1rem 0;
    padding: .9rem 1rem;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
}

.cetele-form-page .alert-error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.cetele-form-page .alert-success {
    border: 1px solid #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.cetele-form-page .form-container {
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.cetele-form-page .cetele-form {
    display: grid;
    gap: 1rem;
}

.cetele-form-page .form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
}

.cetele-form-page .form-group {
    display: grid;
    gap: .48rem;
    min-width: 0;
}

.cetele-form-page .form-group.full-width {
    grid-column: 1 / -1;
}

.cetele-form-page .form-group label {
    color: var(--mk-ink, #18181b);
    font-size: .94rem;
    font-weight: 950;
}

.cetele-form-page .form-group input[type="text"],
.cetele-form-page .form-group input[type="date"],
.cetele-form-page .form-group select,
.cetele-form-page .form-group textarea,
.cetele-form-page .form-group input[type="file"] {
    width: 100%;
    min-height: 46px;
    padding: .82rem .9rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    line-height: 1.55;
    outline: 0;
    transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.cetele-form-page .form-group textarea {
    min-height: 165px;
    resize: vertical;
}

.cetele-form-page .form-group input[type="file"] {
    padding: .7rem;
    background: #f8fafc;
    cursor: pointer;
}

.cetele-form-page .form-group input[type="text"]:focus,
.cetele-form-page .form-group input[type="date"]:focus,
.cetele-form-page .form-group select:focus,
.cetele-form-page .form-group textarea:focus,
.cetele-form-page .form-group input[type="file"]:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.cetele-form-page .form-group input::placeholder,
.cetele-form-page .form-group textarea::placeholder {
    color: #94a3b8;
}

.cetele-form-page .form-group small {
    display: block;
    padding: .75rem .85rem;
    border: 1px solid #fed7aa;
    border-radius: var(--mk-radius, 8px);
    background: #fff7ed;
    color: #9a3412;
    font-size: .84rem;
    font-weight: 800;
    line-height: 1.55;
}

.cetele-form-page .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    padding-top: .25rem;
}

.cetele-form-page .inline-action-form {
    display: inline-flex;
}

.cetele-edit-page .edit-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 1rem;
    align-items: start;
}

.cetele-edit-page .files-container {
    position: sticky;
    top: 1rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.cetele-edit-page .files-container h3 {
    margin: 0 0 .85rem;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 950;
    letter-spacing: 0;
}

.cetele-edit-page .empty-files {
    padding: 1.5rem 1rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #f8fafc;
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.cetele-edit-page .empty-files p {
    margin: 0;
}

.cetele-edit-page .files-list {
    display: grid;
    gap: .7rem;
}

.cetele-edit-page .file-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .75rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #f8fafc;
}

.cetele-edit-page .file-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #bfdbfe;
    border-radius: var(--mk-radius, 8px);
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 1.2rem;
}

.cetele-edit-page .file-info {
    min-width: 0;
    flex: 1;
}

.cetele-edit-page .file-name {
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cetele-edit-page .file-size {
    margin-top: .2rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
}

.cetele-edit-page .file-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.cetele-edit-page .btn-download,
.cetele-edit-page .btn-delete-file {
    width: 36px;
    height: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, transform .16s ease;
}

.cetele-edit-page .btn-download {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.cetele-edit-page .btn-download:hover {
    background: #dbeafe;
    transform: translateY(-1px);
}

.cetele-edit-page .btn-delete-file {
    border-color: #fecaca;
    background: #fef2f2;
}

.cetele-edit-page .btn-delete-file:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

.cetele-form-page .btn-submit:disabled {
    cursor: not-allowed;
    opacity: .7;
    transform: none;
    box-shadow: none;
}

.cetele-form-page .btn-back:focus-visible,
.cetele-form-page .btn-submit:focus-visible,
.cetele-form-page .btn-cancel:focus-visible,
.cetele-form-page .form-group input:focus-visible,
.cetele-form-page .form-group select:focus-visible,
.cetele-form-page .form-group textarea:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@media(max-width: 760px) {
    .cetele-form-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .cetele-form-page .cetele-header,
    .cetele-form-page .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .cetele-form-page .form-row {
        grid-template-columns: 1fr;
    }

    .cetele-edit-page .edit-grid {
        grid-template-columns: 1fr;
    }

    .cetele-edit-page .files-container {
        position: static;
    }

    .cetele-form-page .btn-back,
    .cetele-form-page .btn-submit,
    .cetele-form-page .btn-cancel {
        width: 100%;
    }
}

@media(max-width: 520px) {
    .cetele-form-page .cetele-header,
    .cetele-form-page .form-container {
        padding: .9rem;
    }
}

@media print {
    .cetele-form-page .cetele-header,
    .cetele-form-page .form-actions {
        display: none !important;
    }

    .cetele-form-page .form-container {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* Phase 25: cetele category management unified layout */
.cetele-category-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.cetele-category-page .cetele-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.cetele-category-page .header-left h1 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: clamp(1.45rem, 2.4vw, 2rem);
    font-weight: 950;
    letter-spacing: 0;
}

.cetele-category-page .header-left p {
    margin: .25rem 0 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.cetele-category-page .btn-back,
.cetele-category-page .btn-submit,
.cetele-category-page .btn-edit-cat,
.cetele-category-page .btn-delete-cat,
.cetele-category-page .btn-primary,
.cetele-category-page .btn-secondary {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .7rem .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.cetele-category-page .btn-back:hover,
.cetele-category-page .btn-submit:hover,
.cetele-category-page .btn-edit-cat:hover,
.cetele-category-page .btn-delete-cat:hover,
.cetele-category-page .btn-primary:hover,
.cetele-category-page .btn-secondary:hover {
    transform: translateY(-1px);
}

.cetele-category-page .btn-submit,
.cetele-category-page .btn-primary {
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.cetele-category-page .btn-submit:hover,
.cetele-category-page .btn-primary:hover {
    border-color: #991b1b;
    background: #991b1b;
}

.cetele-category-page .btn-back:hover,
.cetele-category-page .btn-secondary:hover {
    border-color: rgba(127, 29, 29, .32);
    background: #fff7ed;
    color: var(--mk-brand, #7f1d1d);
}

.cetele-category-page .btn-edit-cat {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.cetele-category-page .btn-delete-cat {
    width: 40px;
    padding: 0;
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.cetele-category-page .inline-action-form {
    display: inline-flex;
}

.cetele-category-page .alert {
    margin: 1rem 0;
    padding: .9rem 1rem;
    border-radius: var(--mk-radius, 8px);
    font-weight: 900;
}

.cetele-category-page .alert-success {
    border: 1px solid #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.cetele-category-page .alert-error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.cetele-category-page .alert-warning {
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.cetele-category-page .limit-info,
.cetele-category-page .categories-list,
.cetele-category-page .category-form-box {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.cetele-category-page .limit-info {
    display: grid;
    gap: .65rem;
    margin: 1rem 0;
    padding: 1rem;
}

.cetele-category-page .limit-bar {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #f1f5f9;
}

.cetele-category-page .limit-progress {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 0;
    border-radius: inherit;
    background: transparent;
    appearance: none;
}

.cetele-category-page .limit-progress::-webkit-progress-bar {
    border-radius: inherit;
    background: transparent;
}

.cetele-category-page .limit-progress::-webkit-progress-value {
    border-radius: inherit;
    background: linear-gradient(90deg, #16a34a, var(--mk-brand, #7f1d1d));
}

.cetele-category-page .limit-progress::-moz-progress-bar {
    border-radius: inherit;
    background: linear-gradient(90deg, #16a34a, var(--mk-brand, #7f1d1d));
}

.cetele-category-page .limit-text {
    color: var(--mk-ink-soft, #334155);
    font-weight: 850;
}

.cetele-category-page .limit-remaining {
    color: #166534;
    font-weight: 950;
}

.cetele-category-page .limit-full {
    color: #991b1b;
    font-weight: 950;
}

.cetele-category-page .categories-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 1rem;
    align-items: start;
}

.cetele-category-page .categories-list,
.cetele-category-page .category-form-box {
    padding: 1rem;
}

.cetele-category-page .categories-list h2,
.cetele-category-page .category-form-box h2,
.cetele-category-page .modal-header h2 {
    margin: 0 0 .85rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.18rem;
    font-weight: 950;
    letter-spacing: 0;
}

.cetele-category-page .empty-categories {
    padding: 2rem 1rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #f8fafc;
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.cetele-category-page .category-items,
.cetele-category-page .category-form {
    display: grid;
    gap: .75rem;
}

.cetele-category-page .category-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem;
    overflow: hidden;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #f8fafc;
}

.cetele-category-page .category-item::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--category-color, #64748b);
}

.cetele-category-page .category-icon {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--category-color, #64748b) 36%, #fff);
    border-radius: var(--mk-radius, 8px);
    background: color-mix(in srgb, var(--category-color, #64748b) 12%, #fff);
    color: var(--category-color, #475569);
    font-size: 1.25rem;
}

.cetele-category-page .category-info {
    min-width: 0;
    flex: 1;
}

.cetele-category-page .category-name {
    overflow: hidden;
    color: var(--mk-ink, #18181b);
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cetele-category-page .category-meta {
    display: flex;
    align-items: center;
    gap: .35rem;
    margin-top: .18rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 800;
}

.cetele-category-page .category-color-dot {
    color: var(--category-color, #64748b);
}

.cetele-category-page .category-actions {
    display: flex;
    align-items: center;
    gap: .45rem;
}

.cetele-category-page .form-group {
    display: grid;
    gap: .5rem;
}

.cetele-category-page .form-group label {
    color: var(--mk-ink, #18181b);
    font-weight: 950;
}

.cetele-category-page input[type="text"] {
    width: 100%;
    min-height: 44px;
    padding: .78rem .85rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    outline: 0;
}

.cetele-category-page input[type="text"]:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.cetele-category-page .color-picker,
.cetele-category-page .icon-picker {
    display: grid;
    gap: .45rem;
}

.cetele-category-page .color-picker {
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
}

.cetele-category-page .icon-picker {
    grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
    max-height: 210px;
    overflow: auto;
    padding-right: .25rem;
}

.cetele-category-page .color-picker input[type="radio"],
.cetele-category-page .icon-picker input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cetele-category-page .color-option,
.cetele-category-page .icon-option {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    cursor: pointer;
    font-weight: 900;
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.cetele-category-page .color-option {
    background: var(--category-color, #64748b);
}

.cetele-category-page .color-picker input[type="radio"]:checked + .color-option,
.cetele-category-page .icon-picker input[type="radio"]:checked + .icon-option {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
    transform: translateY(-1px);
}

.cetele-category-page .btn-submit {
    width: 100%;
}

.cetele-category-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, .62);
    backdrop-filter: blur(6px);
}

.cetele-category-modal[hidden] {
    display: none !important;
}

.cetele-category-modal .modal-content {
    width: min(100%, 640px);
    max-height: min(86vh, 760px);
    overflow: auto;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
}

.cetele-category-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
}

.cetele-category-modal .modal-header h2 {
    margin: 0;
}

.cetele-category-modal .close-modal {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 950;
}

.cetele-category-modal form {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.cetele-category-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
}

@supports not (background: color-mix(in srgb, #000 10%, #fff)) {
    .cetele-category-page .category-icon {
        border-color: var(--mk-line, #e4dfd7);
        background: #fff;
        color: var(--mk-ink-soft, #334155);
    }
}

@media(max-width: 960px) {
    .cetele-category-page .categories-grid {
        grid-template-columns: 1fr;
    }
}

@media(max-width: 760px) {
    .cetele-category-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .cetele-category-page .cetele-header,
    .cetele-category-page .category-item,
    .cetele-category-modal .modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .cetele-category-page .btn-back,
    .cetele-category-page .btn-submit,
    .cetele-category-page .btn-primary,
    .cetele-category-page .btn-secondary {
        width: 100%;
    }

    .cetele-category-page .category-actions {
        justify-content: flex-end;
    }
}

@media(max-width: 520px) {
    .cetele-category-page .cetele-header,
    .cetele-category-page .limit-info,
    .cetele-category-page .categories-list,
    .cetele-category-page .category-form-box,
    .cetele-category-modal form {
        padding: .9rem;
    }
}

@media print {
    .cetele-category-page .cetele-header,
    .cetele-category-page .category-actions,
    .cetele-category-page .category-form-box,
    .cetele-category-modal {
        display: none !important;
    }

    .cetele-category-page .categories-grid {
        grid-template-columns: 1fr;
    }

    .cetele-category-page .categories-list {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* Phase 26: personal generated documents archive */
.docs-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.docs-page .docs-hero {
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: linear-gradient(135deg, #3f1717 0%, #7f1d1d 54%, #1f2937 100%);
    color: #fff;
    box-shadow: 0 18px 48px rgba(31, 41, 55, .18);
}

.docs-page .docs-back {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: .8rem;
    color: rgba(255,255,255,.78);
    font-weight: 900;
    text-decoration: none;
}

.docs-page .docs-back:hover {
    color: #fff;
}

.docs-page .docs-hero-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.docs-page .docs-hero h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.55rem, 2.7vw, 2.25rem) !important;
    font-weight: 950 !important;
    letter-spacing: 0 !important;
}

.docs-page .docs-hero p {
    max-width: 760px;
    margin: .35rem 0 0;
    color: rgba(255,255,255,.78);
    line-height: 1.65;
}

.docs-page .docs-hero-layout > a,
.docs-page .docs-empty a,
.docs-page .docs-filter button,
.docs-page .docs-filter a,
.docs-page .docs-card-actions a,
.docs-page .docs-card-actions button,
.docs-page .docs-pagination a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .62rem .82rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.docs-page .docs-hero-layout > a,
.docs-page .docs-empty a,
.docs-page .docs-filter button {
    border-color: #fff;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
}

.docs-page .docs-filter button {
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.docs-page .docs-filter a:hover,
.docs-page .docs-card-actions a:hover,
.docs-page .docs-pagination a:hover {
    border-color: rgba(127, 29, 29, .32);
    background: #fff7ed;
    color: var(--mk-brand, #7f1d1d);
    transform: translateY(-1px);
}

.docs-page .docs-filter button:hover,
.docs-page .docs-empty a:hover,
.docs-page .docs-hero-layout > a:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(127, 29, 29, .16);
}

.docs-page .docs-alert,
.docs-page .docs-filter,
.docs-page .docs-summary,
.docs-page .docs-card,
.docs-page .docs-empty {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.docs-page .docs-alert {
    margin: 1rem 0;
    padding: .9rem 1rem;
    font-weight: 900;
}

.docs-page .docs-alert.success {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.docs-page .docs-alert.danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.docs-page .docs-filter {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    align-items: center;
    gap: .75rem;
    margin: 1rem 0;
    padding: 1rem;
}

.docs-page .docs-filter input {
    width: 100%;
    min-height: 44px;
    padding: .78rem .85rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    outline: 0;
}

.docs-page .docs-filter input:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.docs-page .docs-summary {
    display: flex;
    align-items: baseline;
    gap: .45rem;
    margin: 1rem 0;
    padding: 1rem;
    color: var(--mk-muted, #64748b);
    font-weight: 850;
}

.docs-page .docs-summary strong {
    color: var(--mk-ink, #18181b);
    font-size: 1.55rem;
    font-weight: 950;
}

.docs-page .docs-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.docs-page .docs-card {
    display: flex;
    flex-direction: column;
    min-height: 210px;
    padding: 1rem;
}

.docs-page .docs-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.docs-page .docs-card-top span {
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: .3rem .6rem;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    background: #ecfdf5;
    color: #166534;
    font-size: .76rem;
    font-weight: 950;
}

.docs-page .docs-card-top small,
.docs-page .docs-card p,
.docs-page .docs-empty p {
    color: var(--mk-muted, #64748b);
    line-height: 1.6;
}

.docs-page .docs-card h2,
.docs-page .docs-empty h2 {
    margin: .9rem 0 .45rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.12rem;
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1.35;
}

.docs-page .docs-card p {
    margin: 0 0 1rem;
}

.docs-page .docs-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: auto;
}

.docs-page .docs-card-actions form {
    display: inline-flex;
}

.docs-page .docs-card-actions button {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.docs-page .docs-card-actions button:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

.docs-page .docs-empty {
    margin-top: 1rem;
    padding: 2rem 1rem;
    text-align: center;
}

.docs-page .docs-empty h2 {
    margin-top: 0;
}

.docs-page .docs-empty a {
    margin-top: .75rem;
}

.docs-page .docs-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin-top: 1.25rem;
}

.docs-page .docs-pagination a.active {
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.docs-page .docs-back:focus-visible,
.docs-page .docs-hero-layout > a:focus-visible,
.docs-page .docs-empty a:focus-visible,
.docs-page .docs-filter button:focus-visible,
.docs-page .docs-filter a:focus-visible,
.docs-page .docs-card-actions a:focus-visible,
.docs-page .docs-card-actions button:focus-visible,
.docs-page .docs-pagination a:focus-visible,
.docs-page .docs-filter input:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@media(max-width: 980px) {
    .docs-page .docs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media(max-width: 760px) {
    .docs-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .docs-page .docs-hero-layout,
    .docs-page .docs-filter {
        align-items: stretch;
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .docs-page .docs-hero-layout > a,
    .docs-page .docs-filter button,
    .docs-page .docs-filter a {
        width: 100%;
    }

    .docs-page .docs-grid {
        grid-template-columns: 1fr;
    }
}

@media(max-width: 520px) {
    .docs-page .docs-hero,
    .docs-page .docs-filter,
    .docs-page .docs-card,
    .docs-page .docs-empty {
        padding: .9rem;
    }
}

/* Phase 27: document studio unified layout */
.studio-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.studio-page .studio-hero {
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: linear-gradient(135deg, #3f1717 0%, #7f1d1d 54%, #1f2937 100%);
    color: #fff;
    box-shadow: 0 18px 48px rgba(31, 41, 55, .18);
}

.studio-page .studio-back {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: .8rem;
    color: rgba(255,255,255,.78);
    font-size: .86rem;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
}

.studio-page .studio-back:hover {
    color: #fff;
}

.studio-page .studio-hero-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.studio-page .studio-hero h1 {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin: 0;
    color: #fff;
    font-size: 2.15rem !important;
    font-weight: 950 !important;
    letter-spacing: 0 !important;
    line-height: 1.12;
}

.studio-page .studio-hero h1 svg {
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
}

.studio-page .studio-hero p {
    max-width: 820px;
    margin: .45rem 0 0;
    color: rgba(255,255,255,.78);
    line-height: 1.65;
}

.studio-page .studio-archive-link,
.studio-page .studio-next a,
.studio-page .studio-empty a,
.studio-page .studio-card-foot a,
.studio-page .studio-filter button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .62rem .82rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.studio-page .studio-archive-link {
    flex-shrink: 0;
    border-color: #fff;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
}

.studio-page .studio-next a {
    flex-shrink: 0;
}

.studio-page .studio-card-foot a {
    padding: .55rem .78rem;
}

.studio-page .studio-archive-link:hover,
.studio-page .studio-next a:hover,
.studio-page .studio-empty a:hover,
.studio-page .studio-card-foot a:hover,
.studio-page .studio-filter button:hover {
    border-color: var(--mk-brand-strong, #5f1515);
    background: var(--mk-brand-strong, #5f1515);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(127, 29, 29, .16);
}

.studio-page .studio-notice {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    margin-top: 1rem;
    padding: .9rem 1rem;
    border: 1px solid #fde68a;
    border-radius: var(--mk-radius, 8px);
    background: #fffbeb;
    color: #92400e;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.studio-page .studio-notice strong {
    flex: 0 0 auto;
    font-weight: 950;
}

.studio-page .studio-notice span {
    color: #92400e;
    line-height: 1.55;
}

.studio-page .studio-type-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: .75rem;
    margin-top: 1rem;
}

.studio-page .studio-type-strip a {
    min-width: 0;
    padding: .9rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    text-decoration: none;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
    transition: border-color .16s ease, background-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.studio-page .studio-type-strip a:hover,
.studio-page .studio-type-strip a.active {
    border-color: rgba(127, 29, 29, .32);
    background: #fff7ed;
    transform: translateY(-1px);
}

.studio-page .studio-type-strip a.active {
    box-shadow: inset 0 0 0 1px rgba(127, 29, 29, .16), var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.studio-page .studio-type-strip strong,
.studio-page .studio-type-strip span {
    display: block;
}

.studio-page .studio-type-strip strong {
    color: var(--mk-brand, #7f1d1d);
    font-size: 1.35rem;
    font-weight: 950;
    line-height: 1;
}

.studio-page .studio-type-strip span {
    margin-top: .28rem;
    font-size: .85rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.studio-page .studio-filter {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(190px, 220px) minmax(160px, 190px) auto;
    align-items: center;
    gap: .75rem;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.studio-page .studio-filter input,
.studio-page .studio-filter select {
    width: 100%;
    min-height: 44px;
    padding: .78rem .85rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    outline: 0;
}

.studio-page .studio-filter input:focus,
.studio-page .studio-filter select:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.studio-page .studio-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.studio-page .studio-my-templates {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #fed7aa;
    border-radius: var(--mk-radius, 8px);
    background: #fff7ed;
}

.studio-page .studio-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.studio-page .studio-section-head h2 {
    margin: 0 0 .35rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.18rem;
    font-weight: 950;
    letter-spacing: 0;
}

.studio-page .studio-section-head p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.studio-page .studio-section-head > span {
    flex-shrink: 0;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: .35rem .65rem;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 950;
}

.studio-page .studio-grid-personal {
    margin-top: 0;
}

.studio-page .studio-card {
    min-width: 0;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
    transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.studio-page .studio-card:hover {
    border-color: rgba(127, 29, 29, .28);
    transform: translateY(-2px);
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.studio-page .studio-card-head,
.studio-page .studio-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.studio-page .studio-card-head {
    margin-bottom: 1rem;
}

.studio-page .studio-card-foot {
    margin-top: auto;
    padding-top: 1rem;
}

.studio-page .studio-card-foot span {
    min-width: 0;
    color: var(--mk-muted, #64748b);
    font-size: .85rem;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.studio-page .studio-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fecaca;
    border-radius: var(--mk-radius, 8px);
    background: #fff1f2;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 950;
}

.studio-page .studio-mark.personal {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.studio-page .studio-card-personal {
    border-color: #fed7aa;
    background: linear-gradient(135deg, #fff 0%, #fff7ed 100%);
}

.studio-page .studio-status {
    min-width: 0;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    padding: .32rem .55rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-muted, #64748b);
    font-size: .72rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.studio-page .studio-card h2,
.studio-page .studio-next h2,
.studio-page .studio-empty h2 {
    margin: 0 0 .55rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.12rem;
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.studio-page .studio-card p,
.studio-page .studio-next p,
.studio-page .studio-empty p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.62;
}

.studio-page .studio-empty,
.studio-page .studio-next {
    margin-top: 1rem;
    padding: 1.2rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.studio-page .studio-next {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.studio-page .studio-empty {
    text-align: center;
}

.studio-page .studio-empty a {
    margin-top: .9rem;
}

.studio-page .studio-empty code {
    padding: .12rem .28rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 4px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
    font-size: .9em;
}

.studio-page .studio-back:focus-visible,
.studio-page .studio-archive-link:focus-visible,
.studio-page .studio-next a:focus-visible,
.studio-page .studio-empty a:focus-visible,
.studio-page .studio-card-foot a:focus-visible,
.studio-page .studio-type-strip a:focus-visible,
.studio-page .studio-filter button:focus-visible,
.studio-page .studio-filter input:focus-visible,
.studio-page .studio-filter select:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@media(max-width: 1100px) {
    .studio-page .studio-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .studio-page .studio-type-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .studio-page .studio-filter {
        grid-template-columns: 1fr 1fr;
    }
}

@media(max-width: 760px) {
    .studio-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .studio-page .studio-hero-layout,
    .studio-page .studio-notice,
    .studio-page .studio-section-head,
    .studio-page .studio-next {
        align-items: stretch;
        flex-direction: column;
    }

    .studio-page .studio-hero h1 {
        font-size: 1.65rem !important;
    }

    .studio-page .studio-archive-link,
    .studio-page .studio-next a,
    .studio-page .studio-filter button {
        width: 100%;
    }

    .studio-page .studio-grid,
    .studio-page .studio-type-strip,
    .studio-page .studio-filter {
        grid-template-columns: 1fr;
    }
}

@media(max-width: 520px) {
    .studio-page .studio-hero,
    .studio-page .studio-notice,
    .studio-page .studio-filter,
    .studio-page .studio-my-templates,
    .studio-page .studio-card,
    .studio-page .studio-empty,
    .studio-page .studio-next {
        padding: .9rem;
    }
}

/* Phase 28: document prepare workflow unified layout */
.prepare-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.prepare-page .prepare-hero {
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: linear-gradient(135deg, #3f1717 0%, #7f1d1d 54%, #1f2937 100%);
    color: #fff;
    box-shadow: 0 18px 48px rgba(31, 41, 55, .18);
}

.prepare-page .prepare-back {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: .8rem;
    color: rgba(255,255,255,.78);
    font-size: .86rem;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
}

.prepare-page .prepare-back:hover {
    color: #fff;
}

.prepare-page .prepare-hero-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.prepare-page .prepare-hero h1 {
    max-width: 920px;
    margin: 0;
    color: #fff;
    font-size: 2.15rem !important;
    font-weight: 950 !important;
    letter-spacing: 0 !important;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.prepare-page .prepare-hero p {
    max-width: 820px;
    margin: .45rem 0 0;
    color: rgba(255,255,255,.78);
    line-height: 1.65;
}

.prepare-page .prepare-hero-layout > span,
.prepare-page .legal-check-head > span,
.prepare-page .preview-head span {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: .35rem .65rem;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    color: #fff;
    font-size: .78rem;
    font-weight: 950;
    line-height: 1;
    white-space: nowrap;
}

.prepare-page .prepare-warning,
.prepare-page .prepare-alert,
.prepare-page .legal-check-panel,
.prepare-page .prepare-form,
.prepare-page .prepare-preview,
.prepare-page .prepare-message {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.prepare-page .prepare-warning,
.prepare-page .prepare-alert {
    margin-top: 1rem;
    padding: .9rem 1rem;
}

.prepare-page .prepare-warning {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.prepare-page .prepare-warning strong {
    flex: 0 0 auto;
    font-weight: 950;
}

.prepare-page .prepare-warning span {
    line-height: 1.55;
}

.prepare-page .prepare-info-note-guide {
    display: grid;
    grid-template-columns: minmax(220px, .9fr) minmax(0, 1.4fr);
    gap: 1rem;
    align-items: start;
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid rgba(127, 29, 29, .14);
    border-radius: var(--mk-radius, 8px);
    background: linear-gradient(135deg, #fff7ed 0%, #fff 100%);
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.prepare-page .prepare-info-note-guide strong,
.prepare-page .prepare-info-note-guide span {
    display: block;
}

.prepare-page .prepare-info-note-guide strong {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 950;
}

.prepare-page .prepare-info-note-guide span,
.prepare-page .prepare-info-note-guide li {
    color: var(--mk-muted, #64748b);
    font-size: .9rem;
    line-height: 1.55;
}

.prepare-page .prepare-info-note-guide ol {
    margin: 0;
    padding-left: 1.2rem;
}

.prepare-page .prepare-info-note-guide li + li {
    margin-top: .35rem;
}

.prepare-page .prepare-alert {
    font-weight: 850;
}

.prepare-page .prepare-alert.warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.prepare-page .prepare-alert.danger {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.prepare-page .prepare-alert.success {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #166534;
}

.prepare-page .legal-check-panel {
    margin-top: 1rem;
    padding: 1rem;
    border-color: #fed7aa;
    background: #fff7ed;
}

.prepare-page .legal-check-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .9rem;
}

.prepare-page .legal-check-head h2,
.prepare-page .preview-head h2,
.prepare-page .prepare-message h1 {
    margin: 0 0 .35rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.18rem;
    font-weight: 950;
    letter-spacing: 0;
}

.prepare-page .legal-check-head p,
.prepare-page .prepare-message p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.6;
}

.prepare-page .legal-check-head > span,
.prepare-page .preview-head span {
    border-color: #fed7aa;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
}

.prepare-page .legal-check-list {
    display: grid;
    gap: .75rem;
}

.prepare-page .legal-check-item {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem;
    border: 1px solid #fed7aa;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.prepare-page .legal-check-item strong,
.prepare-page .legal-check-item span,
.prepare-page .legal-check-item small {
    display: block;
}

.prepare-page .legal-check-item strong {
    color: var(--mk-ink, #18181b);
    font-weight: 950;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.prepare-page .legal-check-item span,
.prepare-page .legal-check-item small {
    margin-top: .25rem;
    color: var(--mk-muted, #64748b);
    line-height: 1.5;
}

.prepare-page .legal-check-item a,
.prepare-page .prepare-message a,
.prepare-page .prepare-actions button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .62rem .82rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.prepare-page .legal-check-item a {
    flex-shrink: 0;
}

.prepare-page .prepare-message a {
    margin-top: 1rem;
}

.prepare-page .legal-check-item a:hover,
.prepare-page .prepare-message a:hover,
.prepare-page .prepare-actions button:hover {
    border-color: var(--mk-brand-strong, #5f1515);
    background: var(--mk-brand-strong, #5f1515);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(127, 29, 29, .16);
}

.prepare-page .prepare-layout {
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(380px, 1.05fr);
    gap: 1rem;
    margin-top: 1rem;
    align-items: start;
}

.prepare-page .prepare-form,
.prepare-page .prepare-preview {
    min-width: 0;
    padding: 1rem;
}

.prepare-page .prepare-form label {
    display: grid;
    gap: .45rem;
    margin-bottom: .9rem;
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
}

.prepare-page .prepare-form label > span {
    line-height: 1.35;
}

.prepare-page .prepare-form em {
    color: var(--mk-brand, #7f1d1d);
    font-style: normal;
}

.prepare-page .prepare-form input,
.prepare-page .prepare-form textarea,
.prepare-page .prepare-form select {
    width: 100%;
    min-height: 44px;
    padding: .78rem .85rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    outline: 0;
}

.prepare-page .prepare-form textarea {
    resize: vertical;
}

.prepare-page .prepare-form input:focus,
.prepare-page .prepare-form textarea:focus,
.prepare-page .prepare-form select:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.prepare-page .field-help {
    display: block;
    margin-top: -.2rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.45;
}

.prepare-page .custom-template-panel {
    margin-top: 1rem;
    padding: 0;
    overflow: hidden;
    border: 1px solid #fed7aa;
    border-radius: var(--mk-radius, 8px);
    background: #fff7ed;
}

.prepare-page .custom-template-panel summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
    list-style: none;
}

.prepare-page .custom-template-panel summary::-webkit-details-marker {
    display: none;
}

.prepare-page .custom-template-panel summary::after {
    content: "Ac";
    flex-shrink: 0;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: .35rem .65rem;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 950;
    line-height: 1;
}

.prepare-page .custom-template-panel[open] summary::after {
    content: "Kapat";
}

.prepare-page .custom-template-panel summary strong,
.prepare-page .custom-template-panel summary span {
    display: block;
}

.prepare-page .custom-template-panel summary strong {
    color: var(--mk-ink, #18181b);
    font-weight: 950;
}

.prepare-page .custom-template-panel summary span {
    margin-top: .2rem;
    color: var(--mk-muted, #64748b);
    font-weight: 750;
    line-height: 1.45;
}

.prepare-page .custom-template-panel > label,
.prepare-page .custom-template-help {
    margin: 0 1rem 1rem;
}

.prepare-page .custom-template-toggle {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center;
    gap: .55rem !important;
    padding: .75rem;
    border: 1px solid #fed7aa;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.prepare-page .custom-template-toggle input {
    width: auto;
    min-height: auto;
}

.prepare-page .custom-template-panel textarea {
    min-height: 260px;
    font-family: var(--font-mono, Consolas, "Courier New", monospace);
    line-height: 1.6;
}

.prepare-page .custom-template-help {
    padding: .8rem;
    border: 1px solid #fed7aa;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    line-height: 1.55;
}

.prepare-page .custom-template-help strong,
.prepare-page .custom-template-help span {
    display: block;
}

.prepare-page .custom-template-help code {
    padding: .12rem .28rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 4px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
    font-size: .9em;
}

.prepare-page .prepare-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
}

.prepare-page .prepare-actions .secondary,
.prepare-page .prepare-actions .template-save {
    border-color: var(--mk-line, #e4dfd7);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
}

.prepare-page .prepare-actions .secondary:hover,
.prepare-page .prepare-actions .template-save:hover {
    border-color: rgba(127, 29, 29, .32);
    background: #fff7ed;
    color: var(--mk-brand, #7f1d1d);
}

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

.prepare-page .preview-head h2 {
    margin: 0;
}

.prepare-page .preview-head-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: .55rem;
    flex-wrap: wrap;
}

.prepare-page .preview-copy-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .48rem .7rem;
    border: 1px solid rgba(127, 29, 29, .18);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    cursor: pointer;
    font: inherit;
    font-size: .84rem;
    font-weight: 950;
    line-height: 1;
}

.prepare-page .preview-copy-button:hover,
.prepare-page .preview-copy-button:focus-visible {
    border-color: rgba(127, 29, 29, .34);
    background: #fff7ed;
}

.prepare-page .preview-copy-button:disabled {
    cursor: wait;
    opacity: .72;
}

.prepare-page .prepare-preview pre {
    min-height: 520px;
    margin: 0;
    padding: 1.2rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fbfaf8;
    color: var(--mk-ink, #18181b);
    white-space: pre-wrap;
    overflow-x: auto;
    line-height: 1.75;
    font: 15px/1.75 Georgia, "Times New Roman", serif;
}

.prepare-page .preview-copy-status {
    min-height: 1.25rem;
    margin: .65rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
    font-weight: 800;
}

.prepare-page .preview-empty {
    min-height: 320px;
    display: grid;
    place-content: center;
    gap: .5rem;
    padding: 1rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.prepare-page .preview-empty p {
    margin: 0;
}

.prepare-page .prepare-message {
    margin-top: 1rem;
    padding: 1.4rem;
}

.prepare-page .prepare-back:focus-visible,
.prepare-page .legal-check-item a:focus-visible,
.prepare-page .prepare-message a:focus-visible,
.prepare-page .prepare-actions button:focus-visible,
.prepare-page .prepare-form input:focus-visible,
.prepare-page .prepare-form textarea:focus-visible,
.prepare-page .prepare-form select:focus-visible,
.prepare-page .custom-template-panel summary:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@media(max-width: 1100px) {
    .prepare-page .prepare-layout {
        grid-template-columns: 1fr;
    }
}

@media(max-width: 760px) {
    .prepare-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .prepare-page .prepare-hero-layout,
    .prepare-page .prepare-warning,
    .prepare-page .prepare-info-note-guide,
    .prepare-page .legal-check-head,
    .prepare-page .legal-check-item,
    .prepare-page .custom-template-panel summary,
    .prepare-page .preview-head {
        align-items: stretch;
        flex-direction: column;
    }

    .prepare-page .prepare-hero h1 {
        font-size: 1.65rem !important;
    }

    .prepare-page .prepare-hero-layout > span,
    .prepare-page .legal-check-head > span,
    .prepare-page .preview-head span,
    .prepare-page .legal-check-item a,
    .prepare-page .prepare-actions button,
    .prepare-page .preview-head-actions,
    .prepare-page .preview-copy-button {
        width: 100%;
    }
}

@media(max-width: 520px) {
    .prepare-page .prepare-hero,
    .prepare-page .prepare-warning,
    .prepare-page .prepare-info-note-guide,
    .prepare-page .legal-check-panel,
    .prepare-page .prepare-form,
    .prepare-page .prepare-preview,
    .prepare-page .prepare-message {
        padding: .9rem;
    }
}

/* Phase 29: generated document view unified layout */
.view-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.view-page .view-hero {
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: linear-gradient(135deg, #3f1717 0%, #7f1d1d 54%, #1f2937 100%);
    color: #fff;
    box-shadow: 0 18px 48px rgba(31, 41, 55, .18);
}

.view-page .view-back {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin-bottom: .8rem;
    color: rgba(255,255,255,.78);
    font-size: .86rem;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
}

.view-page .view-back:hover {
    color: #fff;
}

.view-page .view-hero-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.view-page .view-hero h1 {
    max-width: 860px;
    margin: 0 0 .45rem;
    color: #fff;
    font-size: 2.15rem !important;
    font-weight: 950 !important;
    letter-spacing: 0 !important;
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.view-page .view-hero p {
    margin: 0;
    color: rgba(255,255,255,.78);
    line-height: 1.55;
}

.view-page .view-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .55rem;
    flex-shrink: 0;
}

.view-page .view-actions a,
.view-page .view-actions button,
.view-page .view-verification a,
.view-page .view-legal-row a,
.view-page .view-whatsapp-head button,
.view-page .view-message a {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .62rem .82rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.view-page .view-actions .pdf-action,
.view-page .view-actions .verify-action,
.view-page .view-verification a,
.view-page .view-legal-row a,
.view-page .view-whatsapp-head button,
.view-page .view-message a {
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.view-page .view-actions a:hover,
.view-page .view-actions button:hover,
.view-page .view-verification a:hover,
.view-page .view-legal-row a:hover,
.view-page .view-whatsapp-head button:hover,
.view-page .view-message a:hover {
    border-color: var(--mk-brand-strong, #5f1515);
    background: var(--mk-brand-strong, #5f1515);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(127, 29, 29, .16);
}

.view-page .view-warning,
.view-page .view-verification,
.view-page .view-legal-panel,
.view-page .document-paper,
.view-page .view-whatsapp-panel,
.view-page .view-message {
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.view-page .view-warning {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    margin-top: 1rem;
    padding: .9rem 1rem;
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.view-page .view-warning strong {
    flex: 0 0 auto;
    font-weight: 950;
}

.view-page .view-warning span {
    line-height: 1.55;
}

.view-page .view-verification {
    display: grid;
    grid-template-columns: minmax(190px, .65fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    border-color: #fed7aa;
    background: #fff7ed;
    color: var(--mk-ink-soft, #334155);
}

.view-page .view-verification strong,
.view-page .view-verification span {
    display: block;
}

.view-page .view-verification strong {
    color: var(--mk-ink, #18181b);
    font-weight: 950;
}

.view-page .view-verification span {
    margin-top: .28rem;
    color: var(--mk-brand, #7f1d1d);
    font-size: 1.04rem;
    font-weight: 950;
    letter-spacing: .06em;
    overflow-wrap: anywhere;
}

.view-page .view-verification p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.view-page .view-verification a {
    white-space: nowrap;
}

.view-page .view-legal-panel {
    margin-top: 1rem;
    padding: 1rem;
    border-color: #fed7aa;
    background: #fff7ed;
}

.view-page .view-legal-head,
.view-page .view-legal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.view-page .view-legal-head {
    margin-bottom: .8rem;
}

.view-page .view-legal-head h2,
.view-page .view-message h1 {
    margin: 0 0 .35rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.18rem;
    font-weight: 950;
    letter-spacing: 0;
}

.view-page .view-legal-head p,
.view-page .view-message p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.view-page .view-legal-head > span {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: .35rem .65rem;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-size: .78rem;
    font-weight: 950;
    line-height: 1;
}

.view-page .view-legal-row {
    min-width: 0;
    margin-top: .65rem;
    padding: .9rem;
    border: 1px solid #fed7aa;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}

.view-page .view-legal-row strong,
.view-page .view-legal-row span {
    display: block;
}

.view-page .view-legal-row strong {
    color: var(--mk-ink, #18181b);
    font-weight: 950;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.view-page .view-legal-row span {
    margin-top: .25rem;
    color: var(--mk-muted, #64748b);
    line-height: 1.5;
}

.view-page .view-legal-row a {
    flex-shrink: 0;
}

.view-page .document-paper {
    margin-top: 1rem;
    padding: 2rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

.view-page .document-paper pre {
    margin: 0;
    color: var(--mk-ink, #18181b);
    white-space: pre-wrap;
    overflow-x: auto;
    font: 16px/1.8 Georgia, "Times New Roman", serif;
}

.view-page .view-whatsapp-panel {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8fafc;
}

.view-page .view-whatsapp-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .9rem;
}

.view-page .view-whatsapp-head h2 {
    margin: 0 0 .25rem;
    color: var(--mk-ink, #18181b);
    font-size: 1.08rem;
    font-weight: 950;
    letter-spacing: 0;
}

.view-page .view-whatsapp-head p {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.view-page .view-whatsapp-head button {
    flex-shrink: 0;
}

.view-page .view-whatsapp-panel pre {
    max-height: 360px;
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    white-space: pre-wrap;
    overflow: auto;
    font: 14px/1.65 Consolas, "Liberation Mono", monospace;
}

.view-page .view-copy-status {
    min-height: 1.25rem;
    margin: .75rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .86rem;
    font-weight: 800;
}

.view-page .view-message {
    margin-top: 1rem;
    padding: 1.4rem;
}

.view-page .view-message a {
    margin-top: 1rem;
}

.view-page .view-back:focus-visible,
.view-page .view-actions a:focus-visible,
.view-page .view-actions button:focus-visible,
.view-page .view-verification a:focus-visible,
.view-page .view-legal-row a:focus-visible,
.view-page .view-whatsapp-head button:focus-visible,
.view-page .view-message a:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@media(max-width: 960px) {
    .view-page .view-hero-layout,
    .view-page .view-legal-head,
    .view-page .view-legal-row,
    .view-page .view-whatsapp-head,
    .view-page .view-warning,
    .view-page .view-verification {
        align-items: stretch;
        flex-direction: column;
    }

    .view-page .view-verification {
        display: flex;
    }

    .view-page .view-actions {
        justify-content: flex-start;
    }
}

@media(max-width: 760px) {
    .view-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .view-page .view-hero h1 {
        font-size: 1.65rem !important;
    }

    .view-page .view-actions a,
    .view-page .view-actions button,
    .view-page .view-verification a,
    .view-page .view-legal-row a,
    .view-page .view-whatsapp-head button {
        width: 100%;
    }
}

@media(max-width: 520px) {
    .view-page .view-hero,
    .view-page .view-warning,
    .view-page .view-verification,
    .view-page .view-legal-panel,
    .view-page .view-whatsapp-panel,
    .view-page .view-message {
        padding: .9rem;
    }

    .view-page .document-paper {
        padding: 1rem;
    }
}

@media print {
    header,
    footer,
    .view-page .view-hero,
    .view-page .view-warning,
    .view-page .view-verification,
    .view-page .view-legal-panel,
    .view-page .view-whatsapp-panel {
        display: none !important;
    }

    .view-page,
    .view-page .document-paper {
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: #fff !important;
    }
}

/* Phase 30: document verification unified layout */
.verify-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.verify-page .verify-card {
    position: relative;
    overflow: hidden;
    min-height: 360px;
    padding: 1.4rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.verify-page .verify-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 6px;
    background: var(--mk-brand, #7f1d1d);
}

.verify-page .verify-card.is-valid {
    border-color: #bbf7d0;
    background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
}

.verify-page .verify-card.is-valid::before {
    background: #166534;
}

.verify-page .verify-card.is-invalid {
    border-color: #fecaca;
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
}

.verify-page .verify-card.is-invalid::before {
    background: var(--mk-brand, #7f1d1d);
}

.verify-page .verify-kicker {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    padding: .35rem .65rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: var(--mk-navy, #111827);
    color: #fff;
    font-size: .78rem;
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1;
}

.verify-page .verify-card h1 {
    max-width: 820px;
    margin: 1rem 0 .7rem;
    color: var(--mk-ink, #18181b);
    font-size: 2.25rem !important;
    font-weight: 950 !important;
    letter-spacing: 0 !important;
    line-height: 1.12;
}

.verify-page .verify-card p {
    max-width: 780px;
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.65;
}

.verify-page .verify-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
    margin: 1.4rem 0 0;
}

.verify-page .verify-details div {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255, 255, 255, .82);
}

.verify-page .verify-details dt {
    color: var(--mk-muted, #64748b);
    font-size: .85rem;
    font-weight: 850;
    line-height: 1.25;
}

.verify-page .verify-details dd {
    margin: .32rem 0 0;
    color: var(--mk-ink, #18181b);
    font-weight: 950;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.verify-page .verify-form {
    display: grid;
    max-width: 620px;
    gap: .85rem;
    margin-top: 1.4rem;
}

.verify-page .verify-form label {
    display: grid;
    gap: .35rem;
    color: var(--mk-ink-soft, #334155);
    font-weight: 900;
}

.verify-page .verify-form input {
    width: 100%;
    min-height: 44px;
    padding: .78rem .85rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    outline: 0;
}

.verify-page .verify-form input:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.verify-page .verify-form button {
    justify-self: start;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .62rem .82rem;
    border: 1px solid var(--mk-brand, #7f1d1d);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.verify-page .verify-form button:hover {
    border-color: var(--mk-brand-strong, #5f1515);
    background: var(--mk-brand-strong, #5f1515);
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(127, 29, 29, .16);
}

.verify-page .verify-form button:focus-visible,
.verify-page .verify-form input:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@media(max-width: 760px) {
    .verify-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .verify-page .verify-card h1 {
        font-size: 1.7rem !important;
    }

    .verify-page .verify-details {
        grid-template-columns: 1fr;
    }

    .verify-page .verify-form button {
        width: 100%;
    }
}

@media(max-width: 520px) {
    .verify-page .verify-card {
        padding: 1rem;
    }
}

/* Phase 31: document upload unified layout */
.upload-document-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    margin: 0 auto;
    padding: 1.25rem 0 2.75rem !important;
    color: var(--mk-ink, #18181b);
}

.upload-document-page .upload-container,
.upload-document-page .upload-wrapper {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.upload-document-page .upload-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: linear-gradient(135deg, #3f1717 0%, #7f1d1d 54%, #1f2937 100%);
    color: #fff;
    box-shadow: 0 18px 48px rgba(31, 41, 55, .18);
}

.upload-document-page .header-content {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .85rem;
}

.upload-document-page .header-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: var(--mk-radius, 8px);
    background: rgba(255,255,255,.12);
    font-size: 1.45rem;
    line-height: 1;
}

.upload-document-page .header-text h1 {
    margin: 0;
    color: #fff;
    font-size: 2.15rem !important;
    font-weight: 950 !important;
    letter-spacing: 0 !important;
    line-height: 1.12;
}

.upload-document-page .header-text p {
    margin: .35rem 0 0;
    color: rgba(255,255,255,.78);
    line-height: 1.55;
}

.upload-document-page .back-button,
.upload-document-page .submit-button,
.upload-document-page .dropdown-trigger,
.upload-document-page .remove-file {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .62rem .82rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}

.upload-document-page .back-button {
    flex-shrink: 0;
    border-color: #fff;
    color: var(--mk-brand, #7f1d1d);
}

.upload-document-page .submit-button {
    border-color: var(--mk-brand, #7f1d1d);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.upload-document-page .back-button svg,
.upload-document-page .submit-button svg,
.upload-document-page .helper-text svg,
.upload-document-page .info-alert svg,
.upload-document-page .error-alert svg,
.upload-document-page .warning-box svg {
    flex: 0 0 auto;
}

.upload-document-page .back-button:hover,
.upload-document-page .submit-button:hover,
.upload-document-page .remove-file:hover {
    border-color: var(--mk-brand-strong, #5f1515);
    background: var(--mk-brand-strong, #5f1515);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(127, 29, 29, .16);
}

.upload-document-page .info-alert,
.upload-document-page .error-alert,
.upload-document-page .info-card,
.upload-document-page .warning-box,
.upload-document-page .upload-form-card {
    margin-top: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-sm, 0 12px 34px rgba(15, 23, 42, .08));
}

.upload-document-page .info-alert,
.upload-document-page .error-alert,
.upload-document-page .info-card,
.upload-document-page .warning-box {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .9rem 1rem;
}

.upload-document-page .info-alert {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.upload-document-page .error-alert {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.upload-document-page .warning-box {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.upload-document-page .info-card {
    border-color: var(--mk-line, #e4dfd7);
}

.upload-document-page .info-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fed7aa;
    border-radius: var(--mk-radius, 8px);
    background: #fff7ed;
    color: var(--mk-brand, #7f1d1d);
}

.upload-document-page .info-content h3,
.upload-document-page .warning-box strong {
    margin: 0 0 .3rem;
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 950;
    letter-spacing: 0;
}

.upload-document-page .info-content p,
.upload-document-page .warning-box p,
.upload-document-page .info-hint {
    margin: 0;
    color: var(--mk-muted, #64748b);
    line-height: 1.6;
}

.upload-document-page .info-hint {
    display: block;
    margin-top: .18rem;
}

.upload-document-page .upload-form-card {
    padding: 1rem;
}

.upload-document-page .upload-form {
    display: grid;
    gap: 1rem;
}

.upload-document-page .input-group {
    display: grid;
    gap: .48rem;
}

.upload-document-page .input-label {
    display: flex;
    align-items: center;
    gap: .45rem;
    color: var(--mk-ink-soft, #334155);
    font-weight: 950;
}

.upload-document-page .required-star {
    color: var(--mk-brand, #7f1d1d);
}

.upload-document-page .optional-badge {
    min-height: 22px;
    display: inline-flex;
    align-items: center;
    padding: .22rem .45rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-muted, #64748b);
    font-size: .74rem;
    font-weight: 900;
}

.upload-document-page .custom-input,
.upload-document-page .custom-textarea,
.upload-document-page .dropdown-search input {
    width: 100%;
    min-height: 44px;
    padding: .78rem .85rem;
    border: 1px solid var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    font: inherit;
    outline: 0;
}

.upload-document-page .custom-textarea {
    resize: vertical;
}

.upload-document-page .custom-input:focus,
.upload-document-page .custom-textarea:focus,
.upload-document-page .dropdown-search input:focus,
.upload-document-page .dropdown-trigger:focus {
    border-color: var(--mk-brand, #7f1d1d);
    box-shadow: 0 0 0 3px rgba(127, 29, 29, .12);
}

.upload-document-page .custom-dropdown {
    position: relative;
}

.upload-document-page .dropdown-trigger {
    width: 100%;
    justify-content: space-between;
    min-height: 46px;
    color: var(--mk-ink, #18181b);
}

.upload-document-page .selected-text.placeholder {
    color: var(--mk-muted, #64748b);
}

.upload-document-page .dropdown-arrow {
    transition: transform .16s ease;
}

.upload-document-page .dropdown-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

.upload-document-page .dropdown-menu {
    position: absolute;
    z-index: 40;
    top: calc(100% + .5rem);
    left: 0;
    right: 0;
    display: none;
    max-height: 360px;
    overflow: hidden;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.upload-document-page .dropdown-menu.active {
    display: block;
}

.upload-document-page .dropdown-search {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem;
    border-bottom: 1px solid var(--mk-line, #e4dfd7);
    background: #fff;
}

.upload-document-page .dropdown-search svg {
    color: var(--mk-muted, #64748b);
}

.upload-document-page .dropdown-options {
    max-height: 288px;
    overflow: auto;
    padding: .45rem;
}

.upload-document-page .option-group + .option-group {
    margin-top: .45rem;
    padding-top: .45rem;
    border-top: 1px solid var(--mk-line, #e4dfd7);
}

.upload-document-page .group-header {
    padding: .45rem .55rem;
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 950;
}

.upload-document-page .option-item {
    padding: .65rem .7rem;
    border-radius: var(--mk-radius, 8px);
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    font-weight: 850;
}

.upload-document-page .option-item:hover,
.upload-document-page .option-item.selected {
    background: #fff7ed;
    color: var(--mk-brand, #7f1d1d);
}

.upload-document-page .option-item.hidden {
    display: none;
}

.upload-document-page .file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.upload-document-page .file-label {
    min-height: 156px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: 1.25rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-ink-soft, #334155);
    cursor: pointer;
    text-align: center;
    transition: border-color .16s ease, background-color .16s ease, color .16s ease, transform .16s ease;
}

.upload-document-page .file-label:hover,
.upload-document-page .file-label.drag-over {
    border-color: var(--mk-brand, #7f1d1d);
    background: #fff7ed;
    color: var(--mk-brand, #7f1d1d);
    transform: translateY(-1px);
}

.upload-document-page .file-label[hidden],
.upload-document-page .file-selected[hidden] {
    display: none !important;
}

/* Phase 32: global page shell width unification */
.site-main > [id="main-content"],
.site-main > .container,
.site-main > .page-container,
.site-main > .tools-page,
.site-main > .law-page-container,
.site-main > .law-detail-page,
.site-main > .article-page,
.site-main > .topic-page,
.site-main > .search-page-container,
.site-main > .mk-legal-search,
.site-main > .mk-aym-search,
.site-main > .mk-announcements,
.site-main > .mk-official-detail,
.site-main > .mk-legal-gateway,
.site-main > .mk-cities-main,
.site-main > .mk-compare-main,
.site-main > .city-page,
.site-main > .compare-page,
.site-main > .announcements-page-container,
.site-main > .emsal-page-container,
.site-main > .aym-page-container,
.site-main > .documents-page-container,
.site-main > .document-view-page,
.site-main > .document-page-container,
.site-main > .studio-page,
.site-main > .docs-page,
.site-main > .verify-page,
.site-main > .prepare-page,
.site-main > .view-page,
.site-main > .classic-forum-wrapper,
.site-main > .new-topic-page,
.site-main > .new-signal-page,
.site-main > .upload-document-page,
.site-main > .signals-page-container,
.site-main > .chat-page-modern,
.site-main > .cetele-page-container,
.site-main > .cetele-container,
.site-main > .leaderboard-page,
.site-main > .users-page,
.site-main > .profile-page,
.site-main > .messages-container,
.site-main > .becayis-wrap,
.site-main > .becayis-form-wrap,
.site-main > .becayis-detay-wrap,
.site-main > .becayis-profil-wrap,
.site-main > .blog-wrap,
.site-main > .blog-post-wrap {
    width: min(100% - (var(--page-gutter) * 2), var(--content-wide)) !important;
    max-width: var(--content-wide) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.site-main > .page-container-narrow,
.site-main > .auth-container,
.site-main > .ban-container {
    width: min(100% - (var(--page-gutter) * 2), var(--content-narrow)) !important;
    max-width: var(--content-narrow) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

@media (max-width: 760px) {
    .site-main > [id="main-content"],
    .site-main > .container,
    .site-main > .page-container,
    .site-main > .tools-page,
    .site-main > .law-page-container,
    .site-main > .law-detail-page,
    .site-main > .article-page,
    .site-main > .topic-page,
    .site-main > .search-page-container,
    .site-main > .mk-legal-search,
    .site-main > .mk-aym-search,
    .site-main > .mk-announcements,
    .site-main > .mk-official-detail,
    .site-main > .mk-legal-gateway,
    .site-main > .mk-cities-main,
    .site-main > .mk-compare-main,
    .site-main > .city-page,
    .site-main > .compare-page,
    .site-main > .announcements-page-container,
    .site-main > .emsal-page-container,
    .site-main > .aym-page-container,
    .site-main > .documents-page-container,
    .site-main > .document-view-page,
    .site-main > .document-page-container,
    .site-main > .studio-page,
    .site-main > .docs-page,
    .site-main > .verify-page,
    .site-main > .prepare-page,
    .site-main > .view-page,
    .site-main > .classic-forum-wrapper,
    .site-main > .new-topic-page,
    .site-main > .new-signal-page,
    .site-main > .upload-document-page,
    .site-main > .signals-page-container,
    .site-main > .chat-page-modern,
    .site-main > .cetele-page-container,
    .site-main > .cetele-container,
    .site-main > .leaderboard-page,
    .site-main > .users-page,
    .site-main > .profile-page,
    .site-main > .messages-container,
    .site-main > .becayis-wrap,
    .site-main > .becayis-form-wrap,
    .site-main > .becayis-detay-wrap,
    .site-main > .becayis-profil-wrap,
    .site-main > .blog-wrap,
    .site-main > .blog-post-wrap,
    .site-main > .page-container-narrow,
    .site-main > .auth-container,
    .site-main > .ban-container {
        width: min(100% - 1.5rem, var(--content-wide)) !important;
    }
}

.upload-document-page .file-label-text span {
    display: block;
}

/* Admin Becayis management */
.admin-becayis-page.bk-wrap {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.admin-becayis-page .bk-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.8rem 2rem;
    border-radius: 14px;
    background: linear-gradient(135deg, #1e40af, #4f46e5);
    color: #fff;
}

.admin-becayis-page .bk-hero h1 {
    margin: 0;
    font-size: 1.7rem;
}

.admin-becayis-page .bk-hero p {
    margin: .3rem 0 0;
    font-size: .9rem;
    opacity: .85;
}

.admin-becayis-page .bk-hero-actions,
.admin-becayis-page .ops-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.admin-becayis-page .bk-ops-brief {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1.15rem;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    background: radial-gradient(circle at top left, rgba(37,99,235,.14), transparent 34%), #fff;
    box-shadow: 0 10px 28px rgba(15,23,42,.07);
}

.admin-becayis-page .ops-kicker {
    display: inline-flex;
    color: #1d4ed8;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-becayis-page .bk-ops-brief h2 {
    margin: .35rem 0;
    color: #111827;
    font-size: 1.2rem;
}

.admin-becayis-page .bk-ops-brief p {
    max-width: 820px;
    margin: 0;
    color: #64748b;
    line-height: 1.65;
}

.admin-becayis-page .ops-actions a,
.admin-becayis-page .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 900;
}

.admin-becayis-page .ops-actions a {
    padding: .72rem 1rem;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
}

.admin-becayis-page .ops-actions a.secondary {
    background: #f1f5f9;
    color: #0f172a;
}

.admin-becayis-page .bk-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-becayis-page .bks {
    padding: 1.2rem;
    border-top: 3px solid #3b82f6;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    text-align: center;
}

.admin-becayis-page .bks.warn { border-color: #f59e0b; }
.admin-becayis-page .bks.danger { border-color: #ef4444; }
.admin-becayis-page .bks.green { border-color: #10b981; }
.admin-becayis-page .bks.purple { border-color: #8b5cf6; }

.admin-becayis-page .bks strong {
    display: block;
    color: #1e293b;
    font-size: 1.8rem;
    font-weight: 800;
}

.admin-becayis-page .bks span {
    color: #6b7280;
    font-size: .8rem;
}

.admin-becayis-page .bk-tools {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
    margin-bottom: 1.2rem;
    padding: 1rem 1.2rem;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.admin-becayis-page .bk-tools input,
.admin-becayis-page .bk-tools select {
    min-width: 140px;
    padding: .45rem .75rem;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: .87rem;
}

.admin-becayis-page .btn-sm {
    min-height: 34px;
    padding: .45rem 1rem;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 700;
}

.admin-becayis-page .btn-primary-sm { background: #2563eb; color: #fff; }
.admin-becayis-page .btn-danger-sm { background: #ef4444; color: #fff; }
.admin-becayis-page .btn-warn-sm { background: #f59e0b; color: #fff; }
.admin-becayis-page .btn-ok-sm { background: #10b981; color: #fff; }
.admin-becayis-page .btn-gray-sm { background: #6b7280; color: #fff; }
.admin-becayis-page .btn-block-sm { width: 100%; }
.admin-becayis-page .btn-link-sm { text-align: center; }

.admin-becayis-page .bk-table-wrap {
    overflow: hidden;
    margin-bottom: 1.5rem;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.admin-becayis-page .bk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .87rem;
}

.admin-becayis-page .bk-table th {
    padding: .7rem 1rem;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    font-size: .75rem;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.admin-becayis-page .bk-table td {
    padding: .65rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.admin-becayis-page .bk-table tr:last-child td {
    border-bottom: none;
}

.admin-becayis-page .bk-table tr:hover td {
    background: #f8fafc;
}

.admin-becayis-page .td-id,
.admin-becayis-page .td-date,
.admin-becayis-page .muted-cell,
.admin-becayis-page .summary-label {
    color: #6b7280;
}

.admin-becayis-page .td-id {
    color: #9ca3af;
    font-size: .8rem;
}

.admin-becayis-page .td-date {
    font-size: .78rem;
    white-space: nowrap;
}

.admin-becayis-page .td-center {
    text-align: center;
}

.admin-becayis-page .td-actions {
    white-space: nowrap;
}

.admin-becayis-page .user-link {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

.admin-becayis-page .listing-title {
    font-size: .82rem;
    font-weight: 700;
}

.admin-becayis-page .listing-subtitle {
    color: #6b7280;
    font-size: .75rem;
}

.admin-becayis-page .expired-note {
    color: #ef4444;
    font-size: .7rem;
}

.admin-becayis-page .match-count-zero {
    color: #9ca3af;
}

.admin-becayis-page .match-count-positive,
.admin-becayis-page .summary-positive {
    color: #059669;
}

.admin-becayis-page .summary-primary,
.admin-becayis-page .rank-count {
    color: #2563eb;
}

.admin-becayis-page .summary-purple {
    color: #7c3aed;
}

.admin-becayis-page .empty-row {
    padding: 2rem;
    color: #9ca3af;
    text-align: center;
}

.admin-becayis-page .st {
    display: inline-block;
    padding: .2rem .55rem;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
}

.admin-becayis-page .st-active { background: #d1fae5; color: #065f46; }
.admin-becayis-page .st-passive { background: #f3f4f6; color: #6b7280; }
.admin-becayis-page .st-cancelled { background: #fee2e2; color: #991b1b; }

.admin-becayis-page .badge-urgent {
    display: inline-flex;
    padding: .15rem .45rem;
    border-radius: 20px;
    background: #fee2e2;
    color: #991b1b;
    font-size: .72rem;
    font-weight: 700;
}

.admin-becayis-page .badge-ban {
    display: inline-flex;
    padding: .15rem .45rem;
    border-radius: 20px;
    background: #fef3c7;
    color: #92400e;
    font-size: .72rem;
}

.admin-becayis-page .act-form {
    display: inline;
}

.admin-becayis-page .act-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 28px;
    margin-right: .2rem;
    padding: .28rem .6rem;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: .75rem;
    font-weight: 700;
    text-decoration: none;
}

.admin-becayis-page .ab-del { background: #fee2e2; color: #991b1b; }
.admin-becayis-page .ab-pass { background: #f3f4f6; color: #374151; }
.admin-becayis-page .ab-act { background: #d1fae5; color: #065f46; }
.admin-becayis-page .ab-urg { background: #fef3c7; color: #92400e; }
.admin-becayis-page .ab-view { background: #dbeafe; color: #1e40af; }
.admin-becayis-page .ab-del:hover { background: #fca5a5; }
.admin-becayis-page .ab-pass:hover { background: #e5e7eb; }
.admin-becayis-page .ab-act:hover { background: #a7f3d0; }
.admin-becayis-page .ab-urg:hover { background: #fde68a; }

.admin-becayis-page .pagi {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem;
    margin-top: 1rem;
}

.admin-becayis-page .pagi a,
.admin-becayis-page .pagi span {
    padding: .45rem .9rem;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    color: #374151;
    font-size: .87rem;
    text-decoration: none;
}

.admin-becayis-page .pagi a:hover,
.admin-becayis-page .pagi span.cur {
    border-color: #2563eb;
    background: #2563eb;
    color: #fff;
}

.admin-becayis-page .flash-ok,
.admin-becayis-page .flash-err {
    margin-bottom: 1rem;
    padding: .75rem 1rem;
    border-radius: 8px;
}

.admin-becayis-page .flash-ok {
    border: 1px solid #6ee7b7;
    background: #d1fae5;
    color: #065f46;
}

.admin-becayis-page .flash-err {
    border: 1px solid #fca5a5;
    background: #fee2e2;
    color: #991b1b;
}

.admin-becayis-page .il-mini,
.admin-becayis-page .summary-list {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.admin-becayis-page .summary-list {
    gap: .5rem;
    font-size: .85rem;
}

.admin-becayis-page .summary-row {
    display: flex;
    justify-content: space-between;
}

.admin-becayis-page .il-top,
.admin-becayis-page .il-bot {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
}

.admin-becayis-page .il-city {
    color: #1e293b;
    font-weight: 700;
}

.admin-becayis-page .il-to {
    color: #3b82f6;
    font-size: .78rem;
}

.admin-becayis-page .sidebar-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 1.5rem;
    align-items: start;
}

.admin-becayis-page .aside-card {
    margin-bottom: 1rem;
    padding: 1.2rem;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.admin-becayis-page .aside-card h3 {
    margin: 0 0 .8rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid #e2e8f0;
    color: #1e293b;
    font-size: .95rem;
}

.admin-becayis-page .quick-form {
    margin-bottom: .5rem;
}

.admin-becayis-page .aside-divider {
    margin: 1rem 0;
    border: 0;
    border-top: 1px solid #f1f5f9;
}

.admin-becayis-page .result-summary {
    margin-bottom: .75rem;
    color: #6b7280;
    font-size: .83rem;
}

.admin-becayis-page .rank-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.admin-becayis-page .rank-list li {
    display: flex;
    justify-content: space-between;
    padding: .4rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: .85rem;
}

.admin-becayis-page .rank-list li:last-child {
    border: none;
}

@media (max-width: 900px) {
    .admin-becayis-page .sidebar-wrap,
    .admin-becayis-page .bk-ops-brief {
        grid-template-columns: 1fr;
    }

    .admin-becayis-page .ops-actions a {
        width: 100%;
    }
}

.upload-document-page .file-label-title {
    color: var(--mk-ink, #18181b);
    font-weight: 950;
}

.upload-document-page .file-label-subtitle {
    margin-top: .2rem;
    color: var(--mk-muted, #64748b);
    font-size: .88rem;
    font-weight: 750;
}

.upload-document-page .file-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .8rem;
    border: 1px solid #bbf7d0;
    border-radius: var(--mk-radius, 8px);
    background: #ecfdf5;
    color: #166534;
    font-weight: 900;
}

.upload-document-page #fileName {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}

.upload-document-page .remove-file {
    width: 34px;
    height: 34px;
    min-height: 34px;
    flex: 0 0 34px;
    padding: 0;
    border-color: #fecaca;
    background: #fff;
    color: #991b1b;
}

.upload-document-page .helper-text {
    display: flex;
    align-items: flex-start;
    gap: .4rem;
    color: var(--mk-muted, #64748b);
    font-size: .86rem;
    line-height: 1.45;
}

.upload-document-page .form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: .25rem;
}

.upload-document-page .submit-button.loading::before {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: uploadSpin .65s linear infinite;
}

.upload-document-page .submit-button:disabled {
    opacity: .72;
    cursor: not-allowed;
    transform: none;
}

@keyframes uploadSpin {
    to {
        transform: rotate(360deg);
    }
}

.upload-document-page .back-button:focus-visible,
.upload-document-page .dropdown-trigger:focus-visible,
.upload-document-page .custom-input:focus-visible,
.upload-document-page .custom-textarea:focus-visible,
.upload-document-page .submit-button:focus-visible,
.upload-document-page .option-item:focus-visible,
.upload-document-page .file-label:focus-visible,
.upload-document-page .remove-file:focus-visible {
    outline: 3px solid rgba(127, 29, 29, .24);
    outline-offset: 2px;
}

@media(max-width: 760px) {
    .upload-document-page {
        width: min(100% - 1.5rem, var(--content-wide, 1400px)) !important;
        padding-top: 1rem !important;
    }

    .upload-document-page .upload-header,
    .upload-document-page .header-content,
    .upload-document-page .info-alert,
    .upload-document-page .error-alert,
    .upload-document-page .info-card,
    .upload-document-page .warning-box {
        align-items: stretch;
        flex-direction: column;
    }

    .upload-document-page .header-text h1 {
        font-size: 1.65rem !important;
    }

    .upload-document-page .back-button,
    .upload-document-page .submit-button {
        width: 100%;
    }

    .upload-document-page .form-actions {
        justify-content: stretch;
    }
}

@media(max-width: 520px) {
    .upload-document-page .upload-header,
    .upload-document-page .info-alert,
    .upload-document-page .error-alert,
    .upload-document-page .info-card,
    .upload-document-page .warning-box,
    .upload-document-page .upload-form-card {
        padding: .9rem;
    }

    .upload-document-page .file-label {
        min-height: 132px;
        flex-direction: column;
    }
}

/* Notification center page */
.notifications-page {
    width: min(100% - 2rem, var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin: 0 auto !important;
    padding: 1.25rem 0 2.5rem !important;
}

.notifications-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.notifications-kicker {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: rgba(255, 255, 255, .72);
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.notifications-hero h1 {
    margin: .35rem 0 .45rem;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    font-weight: 900;
    line-height: 1.08;
}

.notifications-hero p {
    margin: 0;
    max-width: 760px;
    color: rgba(255, 255, 255, .76);
    line-height: 1.6;
}

.notifications-mark-btn {
    min-height: 42px;
    padding: 0 1rem;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    cursor: pointer;
    font-weight: 900;
    white-space: nowrap;
}

.notifications-summary {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    margin-bottom: 1rem;
}

.notifications-summary span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .55rem .8rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: 999px;
    background: #fff;
    color: var(--mk-muted, #64748b);
    font-weight: 800;
}

.notifications-summary strong {
    color: var(--mk-brand, #7f1d1d);
}

.notifications-timeline {
    display: grid;
    gap: .75rem;
}

.notifications-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-ink, #18181b);
    text-decoration: none !important;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.notifications-row.is-unread {
    border-color: rgba(127, 29, 29, .24);
    background: #fff7f7;
}

.notifications-row-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
}

.notifications-row-body {
    min-width: 0;
    display: grid;
    gap: .25rem;
}

.notifications-row-body strong {
    color: var(--mk-ink, #18181b);
    font-size: 1rem;
    font-weight: 900;
}

.notifications-row-body small,
.notifications-row-time {
    color: var(--mk-muted, #64748b);
    line-height: 1.5;
}

.notifications-row-time {
    font-size: .82rem;
    font-weight: 800;
    white-space: nowrap;
}

.notifications-empty-page {
    display: grid;
    justify-items: center;
    gap: .45rem;
    padding: 2rem;
    border: 1px dashed var(--mk-line-strong, #d6cec2);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    color: var(--mk-muted, #64748b);
    text-align: center;
}

.notifications-empty-page span {
    font-size: 2rem;
}

.notifications-empty-page h2 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-weight: 900;
}

.notifications-empty-page p {
    margin: 0;
}

@media(max-width: 760px) {
    .notifications-page {
        width: min(100% - 1rem, var(--content-wide, 1400px)) !important;
    }

    .notifications-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .notifications-mark-btn {
        width: 100%;
    }

    .notifications-row {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .notifications-row-time {
        grid-column: 2;
        white-space: normal;
    }
}

/* Forum Premium Layer */
.forum-prefix,
.forum-topic-detail-page .forum-prefix,
.forum-category-page .forum-prefix {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 23, 42, .08);
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
}

.forum-prefix-question { background: #eff6ff !important; color: #1d4ed8 !important; }
.forum-prefix-help { background: #fff7ed !important; color: #c2410c !important; }
.forum-prefix-guide { background: #ecfdf5 !important; color: #047857 !important; }
.forum-prefix-announcement { background: #fef2f2 !important; color: #b91c1c !important; }
.forum-prefix-discussion { background: #f5f3ff !important; color: #6d28d9 !important; }
.forum-prefix-solved,
.badge-solved,
.forum-topic-detail-page .badge-solved {
    background: #ecfdf5 !important;
    color: #047857 !important;
    border-color: rgba(4, 120, 87, .22) !important;
}

.badge-unread {
    background: #fff7ed !important;
    color: #c2410c !important;
    border-color: rgba(194, 65, 12, .22) !important;
}

.forum-prefix-picker {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.forum-prefix-option {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 999px;
    background: #fff;
    padding: .6rem .85rem;
    font-weight: 800;
    color: #334155;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.forum-prefix-option input {
    accent-color: #dc2626;
}

.forum-prefix-option:has(input:checked) {
    border-color: rgba(220, 38, 38, .45);
    box-shadow: 0 10px 24px rgba(220, 38, 38, .12);
    transform: translateY(-1px);
}

.forum-topic-detail-page .topic-user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    justify-content: flex-end;
    margin-top: .85rem;
}

.forum-topic-detail-page .forum-topic-move-form {
    margin-top: .9rem;
    padding: .9rem;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: #f8fbff;
}

.forum-topic-detail-page .forum-topic-move-fields {
    display: grid;
    grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 1fr) auto;
    gap: .65rem;
    align-items: end;
}

.forum-topic-detail-page .forum-topic-move-fields label {
    display: grid;
    gap: .4rem;
    color: #475569;
    font-size: .78rem;
    font-weight: 900;
}

.forum-topic-detail-page .forum-topic-move-fields select,
.forum-topic-detail-page .forum-topic-move-fields input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: #0f172a;
    font-weight: 800;
}

.forum-topic-detail-page .btn-move-topic {
    min-height: 42px;
    background: #1d4ed8;
    color: #fff;
}

.forum-topic-detail-page .btn-watch.is-watching {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.forum-topic-detail-page .btn-watch-list {
    background: #f8fafc;
    color: #334155;
    border-color: rgba(15, 23, 42, .1);
    text-decoration: none;
}

.forum-topic-detail-page .btn-watch-list:hover {
    background: #eef2ff;
    color: #3730a3;
    border-color: rgba(79, 70, 229, .22);
}

.forum-topic-detail-page .btn-archive-topic {
    background: #fff7ed;
    color: #c2410c;
    border-color: rgba(194, 65, 12, .2);
}

.forum-topic-detail-page .btn-archive-topic:hover {
    background: #ffedd5;
    color: #9a3412;
}

.forum-topic-detail-page .btn-archive-topic.is-saved {
    background: #ecfdf5;
    color: #047857;
    border-color: rgba(4, 120, 87, .22);
}

.forum-topic-detail-page .btn-solution,
.forum-topic-detail-page .btn-solution-clear {
    background: #ecfdf5;
    color: #047857;
    border-color: rgba(4, 120, 87, .22);
}

.forum-watch-page {
    display: grid;
    gap: 1rem;
}

.forum-watch-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    padding: clamp(1.25rem, 2.6vw, 2rem);
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, rgba(17, 24, 39, .96) 0%, rgba(39, 39, 42, .98) 52%, rgba(127, 29, 29, .95) 100%);
    color: #fff;
    box-shadow: var(--mk-shadow-lg, 0 22px 55px rgba(17, 24, 39, .15));
}

.forum-watch-hero h1 {
    margin: .4rem 0 .35rem;
    color: #fff;
    font-size: clamp(2rem, 3.2vw, 2.7rem);
    line-height: 1.08;
    font-weight: 900;
    letter-spacing: 0;
}

.forum-watch-hero p {
    margin: 0;
    color: rgba(255, 255, 255, .76);
}

.forum-watch-back {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
    font-weight: 900;
}

.forum-watch-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: .75rem;
}

.forum-watch-stats div {
    padding: .85rem 1rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
}

.forum-watch-stats strong,
.forum-watch-stats span {
    display: block;
}

.forum-watch-stats strong {
    color: #fff;
    font-size: 1.65rem;
    font-weight: 900;
}

.forum-watch-stats span {
    color: rgba(255, 255, 255, .72);
    font-size: .8rem;
    font-weight: 900;
}

.forum-watch-list {
    display: grid;
    gap: .8rem;
}

.forum-activity-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    padding: .75rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-activity-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 40px;
    padding: .55rem .85rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-weight: 900;
    text-decoration: none;
}

.forum-activity-tabs a:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.forum-activity-tabs a.is-active {
    border-color: rgba(127, 29, 29, .32);
    background: #fff1f2;
    color: var(--mk-brand, #7f1d1d);
}

.forum-mark-read-form {
    margin: 0 0 0 auto;
}

.forum-mark-read-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 40px;
    padding: .55rem .85rem;
    border: 1px solid rgba(4, 120, 87, .2);
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    font-weight: 900;
    cursor: pointer;
}

.forum-mark-read-form button:hover {
    background: #d1fae5;
    color: #065f46;
}

.forum-inline-alert {
    margin: 0;
    border-radius: 10px;
    font-weight: 900;
}

.forum-inline-alert.alert-success {
    border: 1px solid rgba(4, 120, 87, .2);
    background: #ecfdf5;
    color: #047857;
}

.forum-inline-alert.alert-error {
    border: 1px solid rgba(185, 28, 28, .2);
    background: #fef2f2;
    color: #b91c1c;
}

.forum-watch-page .topic-card {
    position: relative;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.forum-watch-page .topic-card:hover {
    border-color: var(--mk-line-strong, #d6cec2);
    box-shadow: 0 16px 34px rgba(24, 24, 27, .10);
    transform: translateY(-1px);
}

.forum-watch-page .topic-card.is-unread {
    border-color: #bfdbfe;
    background: linear-gradient(90deg, #eff6ff 0, #fff 22%);
    box-shadow: 0 18px 38px rgba(37, 99, 235, .11);
}

.forum-watch-page .topic-card.is-unread::before {
    content: "";
    position: absolute;
    inset: 12px auto 12px 0;
    width: 4px;
    border-radius: 999px;
    background: #2563eb;
}

.forum-watch-card {
    align-items: center;
}

.forum-watch-page .topic-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mk-radius, 8px);
    background: var(--mk-surface-muted, #f8fafc);
    color: var(--mk-brand, #7f1d1d);
    box-shadow: inset 0 0 0 1px var(--mk-line, #e4dfd7);
}

.forum-watch-page .topic-info {
    min-width: 0;
}

.forum-watch-page .topic-info h3 {
    margin: 0;
    color: var(--mk-ink, #18181b);
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1.35;
}

.forum-watch-page .topic-info h3 a {
    color: var(--mk-ink, #18181b);
    text-decoration: none;
}

.forum-watch-page .topic-info h3 a:hover {
    color: var(--mk-brand, #7f1d1d);
}

.forum-reply-preview {
    margin: .55rem 0 0;
    padding: .7rem .8rem;
    border-left: 4px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    font-size: .92rem;
    line-height: 1.55;
}

.forum-watch-page .badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-right: .45rem;
    padding: .26rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 900;
    vertical-align: middle;
}

.forum-watch-page .topic-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    margin-top: .65rem;
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
}

.forum-watch-page .topic-author {
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
}

.forum-watch-card .topic-category-link {
    color: #475569;
    text-decoration: none;
    font-weight: 800;
}

.forum-watch-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: .55rem;
    color: #64748b;
    font-size: .84rem;
    font-weight: 800;
}

.forum-watch-card .topic-actions-col {
    display: flex;
    justify-content: flex-end;
}

.forum-watch-page .topic-unread-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    min-height: 32px;
    padding: .35rem .72rem;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.forum-watch-page .topic-unread-link:hover {
    background: #dbeafe;
    color: #1e40af;
}

.forum-watch-page .topic-unread-link.is-muted {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #475569;
}

.forum-watch-empty {
    margin: 0;
}

.forum-saved-list {
    display: grid;
    gap: .8rem;
}

.forum-saved-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-saved-main {
    display: grid;
    gap: .35rem;
    min-width: 0;
}

.forum-saved-main span {
    color: #64748b;
    font-size: .8rem;
    font-weight: 900;
}

.forum-saved-main a {
    color: var(--mk-ink, #18181b);
    font-size: 1.02rem;
    font-weight: 900;
    text-decoration: none;
}

.forum-saved-main a:hover {
    color: var(--mk-brand, #7f1d1d);
}

.forum-saved-main p {
    margin: 0;
    color: #64748b;
    line-height: 1.5;
}

.forum-saved-card form {
    margin: 0;
}

.forum-saved-card button {
    min-height: 38px;
    padding: .55rem .8rem;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fef2f2;
    color: #b91c1c;
    font-weight: 900;
    cursor: pointer;
}

.forum-topic-detail-page .btn-quote {
    background: #f8fafc;
    color: #334155;
}

.forum-topic-detail-page .is-solution-post {
    border-color: rgba(4, 120, 87, .32);
    box-shadow: 0 22px 55px rgba(4, 120, 87, .13);
}

.forum-topic-detail-page .is-first-unread {
    border-color: rgba(37, 99, 235, .38);
    box-shadow: 0 24px 58px rgba(37, 99, 235, .14);
}

.forum-topic-detail-page .is-first-unread::before {
    content: "İlk okunmamış cevap";
    position: absolute;
    top: -13px;
    right: 18px;
    z-index: 2;
    padding: .28rem .7rem;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: .75rem;
    font-weight: 900;
}

.forum-topic-detail-page .alert-info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.forum-topic-detail-page .solution-inline-badge,
.forum-topic-detail-page .reply-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    border: 1px solid rgba(4, 120, 87, .18);
    border-radius: 12px;
    background: #ecfdf5;
    color: #047857;
    padding: .72rem .9rem;
    font-weight: 800;
    margin-bottom: .85rem;
}

.forum-topic-detail-page .reply-context[hidden] {
    display: none;
}

.forum-topic-detail-page .reply-context button {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.forum-topic-detail-page .reply-reference-card {
    display: grid;
    gap: .25rem;
    margin: 0 0 .9rem;
    padding: .78rem .9rem;
    border: 1px solid #dbeafe;
    border-left: 4px solid #2563eb;
    border-radius: 12px;
    background: #f8fbff;
    color: #334155;
    text-decoration: none;
    box-shadow: 0 10px 26px rgba(37, 99, 235, .08);
}

.forum-topic-detail-page .reply-reference-card:hover {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e3a8a;
}

.forum-topic-detail-page .reply-reference-kicker {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #2563eb;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.forum-topic-detail-page .reply-reference-card strong {
    color: #0f172a;
    font-weight: 900;
}

.forum-topic-detail-page .reply-reference-card span:last-child {
    color: #64748b;
    font-size: .9rem;
    line-height: 1.45;
}

.forum-topic-detail-page .related-topics-panel {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: var(--mk-shadow, 0 10px 26px rgba(24, 24, 27, .07));
}

.forum-topic-detail-page .related-topics-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}

.forum-topic-detail-page .related-topics-head span {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: #64748b;
    font-size: .78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.forum-topic-detail-page .related-topics-head h2 {
    margin: .2rem 0 0;
    color: #0f172a;
    font-size: 1.25rem;
    font-weight: 900;
}

.forum-topic-detail-page .related-topics-head > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: .45rem .75rem;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

.forum-topic-detail-page .related-topics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.forum-topic-detail-page .related-topic-card {
    display: grid;
    gap: .55rem;
    padding: .85rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.forum-topic-detail-page .related-topic-meta,
.forum-topic-detail-page .related-topic-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    color: #64748b;
    font-size: .8rem;
    font-weight: 800;
}

.forum-topic-detail-page .related-topic-card h3 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
}

.forum-topic-detail-page .related-topic-card h3 a {
    color: #0f172a;
    font-weight: 900;
    text-decoration: none;
}

.forum-topic-detail-page .related-topic-card h3 a:hover {
    color: var(--mk-brand, #7f1d1d);
}

.forum-topic-detail-page .btn-reply-to {
    border-color: rgba(37, 99, 235, .16);
    background: #eff6ff;
    color: #1d4ed8;
}

.forum-topic-detail-page .btn-reply-to:hover {
    border-color: rgba(37, 99, 235, .32);
    background: #dbeafe;
    color: #1e40af;
}

.forum-topic-detail-page .forum-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-bottom: .55rem;
}

.forum-topic-detail-page .forum-editor-toolbar button {
    min-height: 34px;
    border: 1px solid rgba(15, 23, 42, .1);
    border-radius: 9px;
    background: #fff;
    color: #111827;
    cursor: pointer;
    font-weight: 800;
    padding: .35rem .65rem;
}

.forum-topic-detail-page .forum-editor-toolbar button:hover {
    border-color: rgba(220, 38, 38, .28);
    color: #dc2626;
}

.forum-topic-detail-page .post-body blockquote {
    border-left: 4px solid #dc2626;
    background: #fff7f7;
    border-radius: 10px;
    margin: 1rem 0;
    padding: .85rem 1rem;
    color: #374151;
}

@media(max-width: 760px) {
    .forum-prefix-picker,
    .forum-topic-detail-page .topic-user-actions,
    .forum-watch-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .forum-prefix-option,
    .forum-topic-detail-page .topic-user-actions .btn-modern,
    .forum-watch-card .topic-actions-col,
    .forum-watch-card .topic-unread-link {
        justify-content: center;
        width: 100%;
    }

    .forum-watch-stats {
        grid-template-columns: 1fr;
    }

    .forum-watch-page .topic-card {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .forum-activity-tabs a {
        width: 100%;
    }

    .forum-mark-read-form,
    .forum-mark-read-form button {
        width: 100%;
    }

    .forum-topic-detail-page .related-topics-head {
        flex-direction: column;
        align-items: stretch;
    }

    .forum-topic-detail-page .related-topics-head > a {
        width: 100%;
    }

    .forum-topic-detail-page .related-topics-grid {
        grid-template-columns: 1fr;
    }

    .forum-watch-card .topic-actions-col {
        grid-column: 1 / -1;
    }

    .forum-saved-card {
        grid-template-columns: 1fr;
    }

    .forum-saved-card button {
        width: 100%;
    }

    .forum-topic-detail-page .forum-topic-move-fields {
        grid-template-columns: 1fr;
    }

    .forum-topic-detail-page .btn-move-topic {
        width: 100%;
    }
}

/* Documents Premium Layer */
.doc-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    width: fit-content;
    min-height: 28px;
    padding: .32rem .65rem;
    border: 1px solid rgba(15, 23, 42, .09);
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: .78rem;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.doc-trust-user {
    background: #f8fafc;
    border-color: rgba(100, 116, 139, .22);
    color: #334155;
}

.doc-trust-admin {
    background: #ecfdf5;
    border-color: rgba(5, 150, 105, .22);
    color: #047857;
}

.doc-trust-official {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, .22);
    color: #1d4ed8;
}

.doc-trust-template {
    background: #fff7ed;
    border-color: rgba(234, 88, 12, .24);
    color: #c2410c;
}

.document-trust-panel {
    display: grid;
    gap: .75rem;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid rgba(15, 23, 42, .08);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(248, 250, 252, .96), rgba(255, 255, 255, .98));
    box-shadow: 0 10px 26px rgba(15, 23, 42, .06);
}

.document-trust-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.document-trust-main small,
.document-trust-panel p {
    margin: 0;
    color: #64748b;
    font-weight: 700;
}

.document-trust-panel a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    width: fit-content;
    min-height: 38px;
    padding: .55rem .85rem;
    border: 1px solid rgba(220, 38, 38, .18);
    border-radius: 10px;
    background: #fff;
    color: #b91c1c;
    font-weight: 900;
    text-decoration: none;
}

.document-trust-panel a:hover {
    background: #fef2f2;
    border-color: rgba(220, 38, 38, .32);
}

.document-card-trust {
    margin-bottom: .65rem;
}

@media(max-width: 640px) {
    .document-trust-panel {
        padding: .85rem;
    }

    .document-trust-panel a {
        width: 100%;
    }
}

/* Cross-link cards: connect related product areas such as city guide and forum categories. */
.crosslink-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    margin: 1.1rem 0;
    padding: 1.15rem;
    border: 1px solid rgba(127, 29, 29, .16);
    border-radius: 14px;
    background:
        radial-gradient(circle at top left, rgba(127, 29, 29, .08), transparent 32%),
        #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
}

.crosslink-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #fff7ed;
    color: #7f1d1d;
    border: 1px solid rgba(127, 29, 29, .14);
}

.crosslink-icon svg {
    width: 24px;
    height: 24px;
}

.crosslink-body {
    min-width: 0;
}

.crosslink-kicker {
    display: inline-flex;
    margin-bottom: .25rem;
    color: #7f1d1d;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.crosslink-card h2 {
    margin: 0 0 .35rem;
    color: #172033;
    font-size: clamp(1.08rem, 1.8vw, 1.35rem);
    line-height: 1.22;
}

.crosslink-card p {
    margin: 0;
    color: #64748b;
    line-height: 1.6;
}

.crosslink-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: .72rem 1rem;
    border-radius: 9px;
    background: #7f1d1d;
    color: #fff;
    text-decoration: none;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 10px 20px rgba(127, 29, 29, .18);
}

.crosslink-action:hover {
    background: #5f1515;
    transform: translateY(-1px);
}

@media (max-width: 760px) {
    .crosslink-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .crosslink-action {
        width: 100%;
    }
}

/* Forum discovery board: recent, unanswered, popular and solved topic shortcuts. */
.classic-forum-wrapper .forum-discovery-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 1rem 0 1.15rem;
}

.classic-forum-wrapper .forum-discovery-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e7ded3);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
}

.classic-forum-wrapper .forum-discovery-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding-bottom: .75rem;
    margin-bottom: .35rem;
    border-bottom: 1px solid rgba(148, 163, 184, .2);
}

.classic-forum-wrapper .forum-discovery-head h2 {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin: 0;
    min-width: 0;
    color: var(--mk-ink, #172033);
    font-size: .98rem;
    line-height: 1.2;
}

.classic-forum-wrapper .forum-discovery-head a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: .35rem .62rem;
    border: 1px solid rgba(127, 29, 29, .18);
    border-radius: 999px;
    color: var(--mk-brand, #7f1d1d);
    background: rgba(127, 29, 29, .05);
    text-decoration: none;
    font-size: .78rem;
    font-weight: 900;
}

.classic-forum-wrapper .forum-discovery-head a:hover {
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
}

.classic-forum-wrapper .forum-discovery-list {
    display: grid;
    gap: .55rem;
}

.classic-forum-wrapper .forum-discovery-topic {
    display: grid;
    gap: .22rem;
    min-width: 0;
    padding: .55rem .6rem;
    border-radius: 9px;
    color: inherit;
    text-decoration: none;
}

.classic-forum-wrapper .forum-discovery-topic:hover {
    background: #fff7ed;
}

.classic-forum-wrapper .forum-discovery-title {
    min-width: 0;
    overflow: hidden;
    color: var(--mk-ink, #172033);
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.classic-forum-wrapper .forum-discovery-meta {
    min-width: 0;
    overflow: hidden;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.classic-forum-wrapper .forum-discovery-empty {
    margin: .4rem 0 0;
    color: var(--mk-muted, #64748b);
    font-size: .9rem;
    line-height: 1.5;
}

.classic-forum-wrapper .forum-tag-cloud-card {
    margin: 1rem 0 1.15rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e7ded3);
    border-radius: var(--mk-radius-lg, 10px);
    background: linear-gradient(135deg, #fff 0%, #fff7ed 100%);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .07);
}

.classic-forum-wrapper .forum-tag-cloud-card.is-compact {
    background: #fff;
}

.classic-forum-wrapper .forum-tag-cloud-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
}

.classic-forum-wrapper .forum-tag-cloud-head span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--mk-muted, #64748b);
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.classic-forum-wrapper .forum-tag-cloud-head h2 {
    margin: .12rem 0 0;
    color: var(--mk-ink, #172033);
    font-size: 1.1rem;
    line-height: 1.2;
}

.classic-forum-wrapper .forum-tag-cloud-head a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: .45rem .7rem;
    border: 1px solid rgba(127, 29, 29, .16);
    border-radius: 8px;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-size: .82rem;
    font-weight: 900;
    text-decoration: none;
}

.classic-forum-wrapper .forum-tag-cloud-list,
.forum-topic-detail-page .forum-topic-tags,
.forum-tag-page .forum-topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.classic-forum-wrapper .forum-tag-chip,
.forum-topic-detail-page .forum-topic-tag,
.forum-tag-page .forum-topic-tag {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 34px;
    padding: .42rem .7rem;
    border: 1px solid rgba(127, 29, 29, .13);
    border-radius: 999px;
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-size: .84rem;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.classic-forum-wrapper .forum-tag-chip:hover,
.classic-forum-wrapper .forum-tag-chip.is-active,
.forum-topic-detail-page .forum-topic-tag:hover,
.forum-tag-page .forum-topic-tag:hover {
    border-color: rgba(127, 29, 29, .35);
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(127, 29, 29, .1);
}

.classic-forum-wrapper .forum-tag-chip strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #fee2e2;
    color: #7f1d1d;
    font-size: .76rem;
}

.forum-topic-detail-page .forum-topic-tags {
    margin-top: .9rem;
}

.forum-topic-detail-page .post-card.is-blocked-author {
    border-color: rgba(127, 29, 29, .18);
    background: linear-gradient(135deg, #fff 0%, #fff7ed 100%);
}

.forum-topic-detail-page .forum-blocked-content {
    margin: .65rem 0 1rem;
    border: 1px dashed rgba(127, 29, 29, .32);
    border-radius: 10px;
    background: #fffaf7;
    overflow: hidden;
}

.forum-topic-detail-page .forum-blocked-content summary {
    display: grid;
    gap: .22rem;
    padding: .85rem 1rem;
    color: var(--mk-ink, #172033);
    cursor: pointer;
    list-style: none;
}

.forum-topic-detail-page .forum-blocked-content summary::-webkit-details-marker {
    display: none;
}

.forum-topic-detail-page .forum-blocked-content summary strong {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .95rem;
    font-weight: 950;
}

.forum-topic-detail-page .forum-blocked-content summary span {
    color: var(--mk-muted, #64748b);
    font-size: .86rem;
    line-height: 1.45;
}

.forum-topic-detail-page .forum-blocked-content[open] summary {
    border-bottom: 1px solid rgba(127, 29, 29, .12);
}

.forum-topic-detail-page .forum-blocked-content .post-body {
    padding: 1rem;
}

.forum-topic-detail-page .btn-block-user {
    border-color: rgba(100, 116, 139, .22);
    background: #f8fafc;
    color: #334155;
}

.forum-topic-detail-page .btn-block-user:hover {
    border-color: rgba(127, 29, 29, .26);
    color: var(--mk-brand, #7f1d1d);
}

.forum-tag-page .forum-tag-back {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    width: max-content;
    min-height: 34px;
    margin-bottom: .7rem;
    padding: .45rem .7rem;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    color: #fff;
    text-decoration: none;
    font-size: .84rem;
    font-weight: 900;
}

.forum-tag-page .forum-tag-topic-list {
    display: grid;
    gap: .85rem;
    margin-top: 1rem;
}

.forum-tag-page .forum-tag-topic-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--mk-line, #e7ded3);
    border-radius: var(--mk-radius-lg, 10px);
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
}

.forum-tag-page .forum-tag-topic-main {
    min-width: 0;
}

.forum-tag-page .forum-tag-topic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem .7rem;
    align-items: center;
    margin-bottom: .55rem;
    color: var(--mk-muted, #64748b);
    font-size: .82rem;
    font-weight: 800;
}

.forum-tag-page .forum-tag-topic-meta a {
    color: inherit;
    text-decoration: none;
}

.forum-tag-page .forum-tag-topic-card h2 {
    margin: 0 0 .4rem;
    color: var(--mk-ink, #172033);
    font-size: 1.15rem;
    line-height: 1.25;
}

.forum-tag-page .forum-tag-topic-card h2 a {
    color: inherit;
    text-decoration: none;
}

.forum-tag-page .forum-tag-topic-card h2 a:hover,
.forum-tag-page .forum-tag-topic-meta a:hover,
.forum-tag-page .forum-tag-author:hover {
    color: var(--mk-brand, #7f1d1d);
}

.forum-tag-page .forum-tag-topic-card p {
    margin: 0 0 .75rem;
    color: var(--mk-muted, #64748b);
    line-height: 1.55;
}

.forum-tag-page .forum-tag-topic-side {
    display: grid;
    align-content: center;
    gap: .42rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(148, 163, 184, .22);
    color: var(--mk-muted, #64748b);
    font-size: .84rem;
    font-weight: 800;
}

.forum-tag-page .forum-tag-author {
    color: var(--mk-ink, #172033);
    font-weight: 950;
    text-decoration: none;
}

.forum-tag-page .forum-tag-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .8rem;
    margin: 1rem 0 0;
}

.forum-tag-page .forum-tag-pagination a,
.forum-tag-page .forum-tag-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: .55rem .8rem;
    border: 1px solid var(--mk-line, #e7ded3);
    border-radius: 9px;
    background: #fff;
    color: var(--mk-ink, #172033);
    font-weight: 900;
    text-decoration: none;
}

.forum-tag-page .forum-tag-pagination a:hover {
    border-color: rgba(127, 29, 29, .25);
    color: var(--mk-brand, #7f1d1d);
}

@media(max-width: 1180px) {
    .classic-forum-wrapper .forum-discovery-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media(max-width: 640px) {
    .classic-forum-wrapper .forum-discovery-board {
        grid-template-columns: 1fr;
    }

    .classic-forum-wrapper .forum-tag-cloud-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .classic-forum-wrapper .forum-tag-chip,
    .forum-topic-detail-page .forum-topic-tag,
    .forum-tag-page .forum-topic-tag {
        width: 100%;
        justify-content: space-between;
    }
}

@media(max-width: 820px) {
    .forum-tag-page .forum-tag-topic-card {
        grid-template-columns: 1fr;
    }

    .forum-tag-page .forum-tag-topic-side {
        padding-left: 0;
        padding-top: .8rem;
        border-top: 1px solid rgba(148, 163, 184, .22);
        border-left: 0;
    }
}

/* Shared forum editor: new topic, reply and edit forms use the same writing tools. */
.new-topic-page .forum-editor-toolbar,
.forum-topic-detail-page .forum-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    align-items: center;
    margin: 0 0 .65rem;
    padding: .5rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 10px;
    background: #f8fafc;
}

.new-topic-page .forum-editor-toolbar button,
.forum-topic-detail-page .forum-editor-toolbar button {
    min-height: 34px;
    padding: .45rem .65rem;
    border: 1px solid rgba(15, 23, 42, .12);
    border-radius: 8px;
    background: #fff;
    color: var(--mk-ink, #172033);
    font-size: .86rem;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.mk-editor-tool-button,
.local-markdown-toolbar button,
.EasyMDEContainer .editor-toolbar button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    min-width: 38px !important;
    height: 36px !important;
    padding: 0 !important;
}

.mk-editor-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    color: currentColor;
}

.mk-editor-icon svg {
    display: block;
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.local-markdown-toolbar,
.EasyMDEContainer .editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
}

.new-topic-page .forum-editor-toolbar button:hover,
.forum-topic-detail-page .forum-editor-toolbar button:hover,
.new-topic-page .forum-editor-toolbar button.is-active,
.forum-topic-detail-page .forum-editor-toolbar button.is-active {
    border-color: rgba(127, 29, 29, .3);
    background: var(--mk-brand, #7f1d1d);
    color: #fff;
    box-shadow: 0 8px 18px rgba(127, 29, 29, .14);
}

.new-topic-page .forum-editor-preview,
.forum-topic-detail-page .forum-editor-preview {
    margin-top: .75rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, .25);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
}

.new-topic-page .forum-editor-preview-title,
.forum-topic-detail-page .forum-editor-preview-title {
    padding: .7rem .9rem;
    border-bottom: 1px solid rgba(148, 163, 184, .18);
    background: #f8fafc;
    color: #64748b;
    font-size: .78rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.new-topic-page .forum-editor-preview-body,
.forum-topic-detail-page .forum-editor-preview-body {
    padding: 1rem;
    color: var(--mk-ink, #172033);
    font-size: .96rem;
    line-height: 1.72;
}

.new-topic-page .forum-editor-preview-body :first-child,
.forum-topic-detail-page .forum-editor-preview-body :first-child {
    margin-top: 0;
}

.new-topic-page .forum-editor-preview-body :last-child,
.forum-topic-detail-page .forum-editor-preview-body :last-child {
    margin-bottom: 0;
}

.new-topic-page .forum-editor-preview-body blockquote,
.forum-topic-detail-page .forum-editor-preview-body blockquote {
    margin: .75rem 0;
    padding: .75rem .9rem;
    border-left: 4px solid var(--mk-brand, #7f1d1d);
    border-radius: 8px;
    background: #fff7ed;
    color: #475569;
}

.new-topic-page .forum-editor-preview-body code,
.forum-topic-detail-page .forum-editor-preview-body code {
    padding: .12rem .32rem;
    border-radius: 6px;
    background: #f1f5f9;
    color: #7f1d1d;
    font-size: .9em;
}

.new-topic-page .forum-editor-preview-empty,
.forum-topic-detail-page .forum-editor-preview-empty {
    margin: 0;
    color: #94a3b8;
}

@media(max-width: 640px) {
    .new-topic-page .forum-editor-toolbar,
    .forum-topic-detail-page .forum-editor-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: .6rem;
    }

    .new-topic-page .forum-editor-toolbar button,
    .forum-topic-detail-page .forum-editor-toolbar button {
        flex: 0 0 auto;
        min-height: 36px;
        padding: .48rem .62rem;
        font-size: .82rem;
    }

    .local-markdown-toolbar,
    .EasyMDEContainer .editor-toolbar {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scrollbar-width: thin;
    }
}

/* Forum polls */
.new-topic-page .forum-poll-builder {
    padding: 1rem;
    border: 1px dashed rgba(127, 29, 29, .22);
    border-radius: 12px;
    background: #fff7ed;
}

.new-topic-page .forum-poll-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
    margin-top: .7rem;
}

.forum-topic-detail-page .forum-topic-poll {
    margin: 1rem 0;
    padding: 1.1rem;
    border: 1px solid rgba(127, 29, 29, .16);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

.forum-topic-detail-page .forum-topic-poll-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .85rem;
    margin-bottom: .9rem;
    border-bottom: 1px solid rgba(148, 163, 184, .18);
}

.forum-topic-detail-page .forum-topic-poll-kicker {
    display: inline-flex;
    margin-bottom: .32rem;
    color: #7f1d1d;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.forum-topic-detail-page .forum-topic-poll h2 {
    margin: 0;
    color: var(--mk-ink, #172033);
    font-size: clamp(1.05rem, 1.8vw, 1.35rem);
    line-height: 1.25;
}

.forum-topic-detail-page .forum-topic-poll-total {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: .42rem .7rem;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: .82rem;
    font-weight: 900;
}

.forum-topic-detail-page .forum-poll-options,
.forum-topic-detail-page .forum-poll-results {
    display: grid;
    gap: .7rem;
}

.forum-topic-detail-page .forum-poll-option {
    display: flex;
    align-items: center;
    gap: .7rem;
    min-height: 46px;
    padding: .75rem .85rem;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 10px;
    background: #f8fafc;
    color: #172033;
    font-weight: 800;
    cursor: pointer;
}

.forum-topic-detail-page .forum-poll-option:hover {
    border-color: rgba(127, 29, 29, .28);
    background: #fff7ed;
}

.forum-topic-detail-page .forum-poll-option input {
    width: 18px;
    height: 18px;
    accent-color: #7f1d1d;
}

.forum-topic-detail-page .btn-poll-vote {
    margin-top: .9rem;
}

.forum-topic-detail-page .forum-poll-result {
    display: grid;
    gap: .45rem;
    padding: .78rem .85rem;
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 10px;
    background: #f8fafc;
}

.forum-topic-detail-page .forum-poll-result.is-my-vote {
    border-color: rgba(127, 29, 29, .32);
    background: #fff7ed;
}

.forum-topic-detail-page .forum-poll-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    color: #172033;
}

.forum-topic-detail-page .forum-poll-result-row span {
    flex: 0 0 auto;
    color: #64748b;
    font-size: .86rem;
    font-weight: 900;
}

.forum-topic-detail-page .forum-poll-bar {
    overflow: hidden;
    height: 9px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .2);
}

.forum-topic-detail-page .forum-poll-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7f1d1d, #ef4444);
}

@media(max-width: 640px) {
    .new-topic-page .forum-poll-options-grid {
        grid-template-columns: 1fr;
    }

    .forum-topic-detail-page .forum-topic-poll-head,
    .forum-topic-detail-page .forum-poll-result-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Final notification row overrides with per-item delete actions */
.notifications-timeline .notifications-row {
    display: flex;
    align-items: stretch;
    gap: .7rem;
}

.notifications-timeline .notifications-row-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .85rem;
    flex: 1 1 auto;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.notifications-timeline .notifications-row-delete {
    display: flex;
    align-items: center;
    margin: 0;
}

.notifications-timeline .notifications-row-delete button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(185, 28, 28, .18);
    border-radius: 10px;
    background: #fff;
    color: #991b1b;
    cursor: pointer;
}

.notifications-timeline .notifications-row-delete button:hover {
    background: #fee2e2;
}

@media(max-width: 640px) {
    .notifications-timeline .notifications-row {
        align-items: flex-start;
    }

    .notifications-timeline .notifications-row-main {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .notifications-timeline .notifications-row-time {
        grid-column: 2;
        justify-self: start;
        white-space: normal;
    }
}

/* Modern SVG İkon Hizalaması */
svg.lucide,
.nav-link-icon svg,
.message-icon-header svg,
.notification-bell svg,
.user-menu svg,
.stat-icon svg,
.action-icon svg {
    display: inline-block !important;
    width: 1.15em !important;
    height: 1.15em !important;
    vertical-align: -0.15em !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    fill: none !important;
    flex-shrink: 0 !important;
    transition: stroke var(--transition-fast), transform var(--transition-fast);
}

/* Menü ve buton ikonları için özel boşluklar */
.nav-link-icon svg,
.btn svg,
.quick-action svg {
    margin-right: 0.15em !important;
}

/* Profile icon system: one SVG language, semantic colors by context. */
.profile-page :where(
    .profile-inline-icon,
    .section-title-icon,
    .btn-svg,
    .type-badge-icon,
    .status-badge-icon
) {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    vertical-align: -0.14em;
}

.profile-page :where(.section-title-icon, .btn-svg) {
    margin-right: .35rem;
}

.profile-page :where(.profile-info-label, .stat-label, .content-section h2, .content-section h3, .type-badge, .status-badge) {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.profile-page .profile-stats-mini .stat-mini:first-child .profile-inline-icon {
    color: #b7791f;
}

.profile-page .profile-stats-mini .stat-mini:nth-child(2) .profile-inline-icon {
    color: #be123c;
}

.profile-page .profile-info-city .profile-inline-icon {
    color: #2563eb;
}

.profile-page .profile-info-institution .profile-inline-icon {
    color: #0f766e;
}

.profile-page .stat-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    margin: 0 auto .55rem;
    border-radius: 8px;
    color: var(--profile-icon-color, #475569);
    background: var(--profile-icon-bg, #f1f5f9);
}

.profile-page .stat-icon svg {
    width: 22px;
    height: 22px;
}

.profile-page .stats-grid .stat-box:nth-child(1) {
    --profile-icon-color: #2563eb;
    --profile-icon-bg: #eff6ff;
}

.profile-page .stats-grid .stat-box:nth-child(2) {
    --profile-icon-color: #7c3aed;
    --profile-icon-bg: #f5f3ff;
}

.profile-page .stats-grid .stat-box:nth-child(3) {
    --profile-icon-color: #be123c;
    --profile-icon-bg: #fff1f2;
}

.profile-page .stats-grid .stat-box:nth-child(4) {
    --profile-icon-color: #b7791f;
    --profile-icon-bg: #fffbeb;
}

.profile-page .stats-grid .stat-box:nth-child(5) {
    --profile-icon-color: #047857;
    --profile-icon-bg: #ecfdf5;
}

.profile-page .invite-stats-bar .stat-item:nth-child(1) {
    --profile-icon-color: #7c3aed;
    --profile-icon-bg: #f5f3ff;
}

.profile-page .invite-stats-bar .stat-item:nth-child(2) {
    --profile-icon-color: #2563eb;
    --profile-icon-bg: #eff6ff;
}

.profile-page .invite-stats-bar .stat-item:nth-child(3) {
    --profile-icon-color: #047857;
    --profile-icon-bg: #ecfdf5;
}

.profile-page .invite-stats-bar .stat-item:nth-child(4) {
    --profile-icon-color: #b7791f;
    --profile-icon-bg: #fffbeb;
}

.profile-page .invite-stats-bar .stat-item:nth-child(5) {
    --profile-icon-color: #991b1b;
    --profile-icon-bg: #fef2f2;
}

.profile-page .badge-item {
    --achievement-color: #2563eb;
    --achievement-bg: #eff6ff;
}

.profile-page .badge-item.badge-legendary {
    --achievement-color: #991b1b;
    --achievement-bg: #fef2f2;
}

.profile-page .badge-item.badge-gold {
    --achievement-color: #a16207;
    --achievement-bg: #fffbeb;
}

.profile-page .badge-item.badge-silver {
    --achievement-color: #475569;
    --achievement-bg: #f1f5f9;
}

.profile-page .badge-item.badge-bronze {
    --achievement-color: #9a5b35;
    --achievement-bg: #fff7ed;
}

.profile-page .badge-icon,
.profile-page .activity-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 42px;
    color: var(--achievement-color, #2563eb);
    background: var(--achievement-bg, #eff6ff);
}

.profile-page :where(.badge-icon, .activity-icon) svg {
    width: 22px;
    height: 22px;
}

.profile-page .activity-icon {
    --achievement-color: #2563eb;
    --achievement-bg: #eff6ff;
}

:where(.user-rank-badge-icon, .verified-institution-icon, .package-icon, .rank-package-pill) svg {
    display: block;
    width: 1em;
    height: 1em;
}

.user-rank-badge-icon {
    display: inline-grid;
    place-items: center;
}

.user-rank-badge-icon svg {
    width: 16px;
    height: 16px;
}

.verified-institution-icon {
    color: #047857;
}

.verified-institution-icon svg {
    width: 14px;
    height: 14px;
}

/* Shared SVG sizing for administration, moderation, forum and chat surfaces. */
:where(
    .admin-page-title-icon,
    .admin-title-icon,
    .admin-container .stat-icon,
    .mod-container .stat-icon,
    .admin-container .action-icon,
    .mod-container .action-icon,
    .permission-icon,
    .label-icon,
    .meta-icon,
    .role-badge,
    .status-badge,
    .forum-prefix-icon,
    .topic-actions .btn-icon,
    .post-actions .btn-icon
) svg {
    display: inline-block;
    width: 1em;
    height: 1em;
    flex: 0 0 auto;
    vertical-align: -0.14em;
}

:where(.admin-page-title-icon, .admin-title-icon) {
    margin-right: .38rem;
}

:where(
    .admin-container .stat-icon,
    .mod-container .stat-icon,
    .admin-container .action-icon,
    .mod-container .action-icon,
    .permission-icon
) {
    display: inline-grid;
    place-items: center;
}

:where(
    .admin-container .stat-icon,
    .mod-container .stat-icon,
    .admin-container .action-icon,
    .mod-container .action-icon
) svg {
    width: 24px;
    height: 24px;
}

:where(.role-badge, .status-badge, .type-badge, .count-badge, .meta-item) {
    align-items: center;
    gap: .35rem;
}

:where(.role-badge, .status-badge) svg {
    width: 14px;
    height: 14px;
}

.forum-prefix {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.forum-prefix-icon {
    width: 15px;
    height: 15px;
}

:where(.pill-emoji, .room-avatar, .room-emoji, .preview-emoji) {
    display: inline-grid;
    place-items: center;
}

:where(.pill-emoji, .room-avatar, .room-emoji, .preview-emoji) .chat-room-svg,
.chat-room-admin-svg {
    display: block;
    width: 20px;
    height: 20px;
}

.room-avatar .chat-room-svg {
    width: 24px;
    height: 24px;
}

.icon-btn svg,
.category-icon-svg {
    display: block;
    width: 20px;
    height: 20px;
}

.admin-page-title-icon,
.admin-title-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.14em;
}

:where(.module-icon, .mod-module-icon, .ban-icon, .bmn-icon, .category-icon, .card-icon, .popular-icon) {
    display: inline-grid;
    place-items: center;
}

:where(.module-icon, .mod-module-icon) svg {
    width: 26px;
    height: 26px;
}

:where(.ban-icon, .bmn-icon, .category-icon, .card-icon, .popular-icon) svg {
    width: 18px;
    height: 18px;
}

:where(
    .admin-container h1,
    .admin-container h2,
    .admin-container h3,
    .mod-container h1,
    .mod-container h2,
    .mod-container h3,
    .content-section h2
) > svg {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: .35rem;
    vertical-align: -0.14em;
}

:where(.admin-container, .mod-container) :where(button, .btn, a.btn, .btn-sm, .btn-secondary) > svg {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.14em;
}

.brand-coffee-icon {
    display: inline-block;
    width: 1.05em;
    height: 1.05em;
    margin-right: .3rem;
    color: #f8fafc;
    vertical-align: -0.14em;
}

.mobile-menu-btn svg {
    display: block;
    width: 24px;
    height: 24px;
}

:where(.document-type-svg, .file-type-svg, .doc-trust-icon, .cetele-status-svg) {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.14em;
}

.drag-handle svg {
    display: block;
    width: 18px;
    height: 18px;
    margin: 0 auto;
}

/* Controlled chromatic icon language.
   Commands stay neutral; categories, status, modules and achievements carry color. */
:root {
    --mk-icon-blue: #2563eb;
    --mk-icon-blue-bg: #eff6ff;
    --mk-icon-green: #047857;
    --mk-icon-green-bg: #ecfdf5;
    --mk-icon-red: #be123c;
    --mk-icon-red-bg: #fff1f2;
    --mk-icon-gold: #b7791f;
    --mk-icon-gold-bg: #fffbeb;
    --mk-icon-purple: #7c3aed;
    --mk-icon-purple-bg: #f5f3ff;
    --mk-icon-teal: #0f766e;
    --mk-icon-teal-bg: #f0fdfa;
}

:where(
    .stat-icon,
    .tool-icon,
    .cat-icon,
    .cat-icon-big,
    .category-icon,
    .card-icon,
    .popular-icon,
    .room-avatar,
    .room-emoji,
    .preview-emoji,
    .pill-emoji,
    .badge-icon,
    .activity-icon
) {
    --mk-icon-fg: #475569;
    --mk-icon-bg: #f1f5f9;
}

:where(
    .stat-icon,
    .tool-icon,
    .cat-icon,
    .cat-icon-big,
    .category-icon,
    .card-icon,
    .popular-icon,
    .room-avatar,
    .room-emoji,
    .preview-emoji,
    .pill-emoji
) {
    color: var(--mk-icon-fg);
    background-color: var(--mk-icon-bg);
    border-color: color-mix(in srgb, var(--mk-icon-fg) 18%, transparent);
}

:where(
    .stat-icon,
    .tool-icon,
    .cat-icon,
    .cat-icon-big,
    .category-icon,
    .card-icon,
    .popular-icon,
    .room-avatar,
    .room-emoji,
    .preview-emoji,
    .pill-emoji,
    .badge-icon,
    .activity-icon
) svg {
    color: var(--mk-icon-fg);
    filter: drop-shadow(0 2px 3px color-mix(in srgb, var(--mk-icon-fg) 18%, transparent));
}

/* Gold: premium, score and achievement. */
:where(.stat-icon, .tool-icon, .cat-icon, .cat-icon-big, .category-icon, .card-icon, .popular-icon, .badge-icon):has(:where(
    [data-icon="star"],
    [data-icon="crown"],
    [data-icon="trophy"],
    [data-icon="medal"],
    [data-icon="coins"],
    [data-icon="ticket"],
    [data-icon="sun"]
)) {
    --mk-icon-fg: var(--mk-icon-gold);
    --mk-icon-bg: var(--mk-icon-gold-bg);
}

/* Red: alerts, urgency and destructive states. */
:where(.stat-icon, .tool-icon, .cat-icon, .cat-icon-big, .category-icon, .card-icon, .popular-icon, .badge-icon):has(:where(
    [data-icon="heart"],
    [data-icon="siren"],
    [data-icon="flame"],
    [data-icon="flag"],
    [data-icon="x"],
    [data-icon="trash"],
    [data-icon="lock"]
)) {
    --mk-icon-fg: var(--mk-icon-red);
    --mk-icon-bg: var(--mk-icon-red-bg);
}

/* Green: verification, health and completed states. */
:where(.stat-icon, .tool-icon, .cat-icon, .cat-icon-big, .category-icon, .card-icon, .popular-icon, .badge-icon):has(:where(
    [data-icon="check"],
    [data-icon="check-square"],
    [data-icon="badge-check"],
    [data-icon="sprout"],
    [data-icon="stethoscope"],
    [data-icon="hand-heart"]
)) {
    --mk-icon-fg: var(--mk-icon-green);
    --mk-icon-bg: var(--mk-icon-green-bg);
}

/* Purple: law, knowledge and editorial tools. */
:where(.stat-icon, .tool-icon, .cat-icon, .cat-icon-big, .category-icon, .card-icon, .popular-icon, .badge-icon):has(:where(
    [data-icon="scale"],
    [data-icon="books"],
    [data-icon="graduation-cap"],
    [data-icon="gem"],
    [data-icon="sparkles"],
    [data-icon="pencil"]
)) {
    --mk-icon-fg: var(--mk-icon-purple);
    --mk-icon-bg: var(--mk-icon-purple-bg);
}

/* Teal: location, institutions and navigation. */
:where(.stat-icon, .tool-icon, .cat-icon, .cat-icon-big, .category-icon, .card-icon, .popular-icon):has(:where(
    [data-icon="map"],
    [data-icon="map-pin"],
    [data-icon="globe"],
    [data-icon="landmark"],
    [data-icon="building-2"],
    [data-icon="refresh"]
)) {
    --mk-icon-fg: var(--mk-icon-teal);
    --mk-icon-bg: var(--mk-icon-teal-bg);
}

/* Blue: documents, communication and general information. */
:where(.stat-icon, .tool-icon, .cat-icon, .cat-icon-big, .category-icon, .card-icon, .popular-icon, .room-avatar, .room-emoji, .preview-emoji, .pill-emoji):has(:where(
    [data-icon="file"],
    [data-icon="file-text"],
    [data-icon="folder"],
    [data-icon="newspaper"],
    [data-icon="download"],
    [data-icon="upload"],
    [data-icon="image"],
    [data-icon="message-circle"],
    [data-icon="message-square"],
    [data-icon="message-2"],
    [data-icon="mail"],
    [data-icon="smartphone"]
)) {
    --mk-icon-fg: var(--mk-icon-blue);
    --mk-icon-bg: var(--mk-icon-blue-bg);
}

/* Compact stored icons get semantic color without becoming decorative cards. */
:where(
    .blog-category-svg,
    .category-icon-svg,
    .cetele-category-svg,
    .forum-prefix-icon,
    .doc-trust-icon,
    .chat-room-svg,
    .chat-room-admin-svg
)[data-icon="folder"],
:where(.blog-category-svg, .category-icon-svg, .cetele-category-svg)[data-icon="file-text"] {
    color: var(--mk-icon-blue);
}

:where(.blog-category-svg, .category-icon-svg, .cetele-category-svg, .forum-prefix-icon)[data-icon="scale"],
:where(.blog-category-svg, .category-icon-svg, .cetele-category-svg)[data-icon="books"] {
    color: var(--mk-icon-purple);
}

:where(.blog-category-svg, .category-icon-svg, .cetele-category-svg, .forum-prefix-icon)[data-icon="map"],
:where(.blog-category-svg, .category-icon-svg, .cetele-category-svg)[data-icon="landmark"] {
    color: var(--mk-icon-teal);
}

:where(.blog-category-svg, .category-icon-svg, .cetele-category-svg, .forum-prefix-icon)[data-icon="flame"],
:where(.forum-prefix-icon, .doc-trust-icon)[data-icon="flag"] {
    color: var(--mk-icon-red);
}

:where(.blog-category-svg, .category-icon-svg, .cetele-category-svg)[data-icon="star"],
:where(.forum-prefix-icon)[data-icon="trophy"] {
    color: var(--mk-icon-gold);
}

.doc-trust-icon[data-icon="badge-check"] {
    color: var(--mk-icon-green);
}

.doc-trust-icon[data-icon="landmark"] {
    color: var(--mk-icon-teal);
}

.hero-title-icon {
    color: #fbbf24;
    filter: drop-shadow(0 3px 6px rgba(251, 191, 36, .28));
}

/* Premium and special packages may sparkle; ordinary controls remain quiet. */
.rank-special-package :where(.rank-package-svg, .user-rank-badge-icon svg, .badge-icon svg),
.user-rank-badge-mini.rank-special-package svg,
.profile-role-pill.rank-special-package svg {
    color: #d4a017;
    filter: drop-shadow(0 0 4px rgba(245, 158, 11, .38));
    animation: mk-premium-icon-glow 3.2s ease-in-out infinite;
}

@keyframes mk-premium-icon-glow {
    0%, 100% {
        filter: drop-shadow(0 0 3px rgba(245, 158, 11, .25));
        transform: translateY(0);
    }
    50% {
        filter: drop-shadow(0 0 7px rgba(245, 158, 11, .52));
        transform: translateY(-1px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .rank-special-package :where(.rank-package-svg, .user-rank-badge-icon svg, .badge-icon svg),
    .user-rank-badge-mini.rank-special-package svg,
    .profile-role-pill.rank-special-package svg {
        animation: none;
    }
}

/* Shared create/edit page language */
.profile-page .stats-grid .stat-box:nth-child(6) { --profile-icon-color: #c2410c; --profile-icon-bg: #fff7ed; }
.profile-page .stats-grid .stat-box:nth-child(7) { --profile-icon-color: #6d28d9; --profile-icon-bg: #f5f3ff; }
.profile-page .stats-grid .stat-box:nth-child(8) { --profile-icon-color: #0f766e; --profile-icon-bg: #f0fdfa; }

.mk-form-page {
    width: min(100% - 2rem, var(--mk-page-max, 1400px));
    margin: 0 auto;
    padding: 1.25rem 0 3rem;
}
.mk-form-hero {
    width: 100%;
    min-height: 106px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1.1rem;
    border: 1px solid var(--mk-line, #e4dfd7);
    border-radius: var(--mk-radius, 8px);
    background: linear-gradient(135deg, #3f1717 0%, #7f1d1d 54%, #1f2937 100%);
    color: #fff;
    box-shadow: 0 18px 48px rgba(31, 41, 55, .18);
    overflow: hidden;
}
.mk-form-hero__content {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: .85rem;
}
.mk-form-hero__copy { min-width: 0; }
.mk-form-hero__back {
    min-height: 42px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .68rem .9rem;
    border: 1px solid #fff;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
    color: var(--mk-brand, #7f1d1d);
    font-weight: 900;
    text-decoration: none;
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.mk-form-hero__back:hover {
    border-color: var(--mk-brand-strong, #5f1515);
    background: var(--mk-brand-strong, #5f1515);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 32px rgba(127, 29, 29, .16);
}
.mk-form-hero__icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 8px;
    background: rgba(255,255,255,.1);
    color: #fff;
}
.mk-form-hero__icon svg { width: 25px; height: 25px; }
.mk-form-hero h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.72rem, 3vw, 2.15rem);
    font-weight: 950;
    letter-spacing: 0;
    line-height: 1.12;
}
.mk-form-hero p {
    max-width: 760px;
    margin: .35rem 0 0;
    color: rgba(255,255,255,.78);
    line-height: 1.55;
}
.mk-form-alert {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    margin: 0 0 1rem;
    padding: .95rem 1rem;
    border: 1px solid;
    border-radius: var(--mk-radius, 8px);
    background: #fff;
}
.mk-form-alert__icon { flex: 0 0 auto; display: inline-flex; margin-top: .05rem; }
.mk-form-alert__icon svg { width: 21px; height: 21px; }
.mk-form-alert strong,.mk-form-alert p { display: block; margin: 0; }
.mk-form-alert p { line-height: 1.55; }
.mk-form-alert--info { color: #1e40af; border-color: #bfdbfe; background: #eff6ff; }
.mk-form-alert--success { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.mk-form-alert--warning { color: #92400e; border-color: #fde68a; background: #fffbeb; }
.mk-form-alert--error { color: #991b1b; border-color: #fecaca; background: #fef2f2; }
@media (max-width:700px) {
    .mk-form-page { width: min(100% - 1rem, var(--mk-page-max, 1400px)); }
    .mk-form-hero {
        min-height: 0;
        align-items: stretch;
        flex-direction: column;
        padding: 1rem;
    }
    .mk-form-hero__content { align-items: flex-start; }
    .mk-form-hero__back { width: 100%; }
}
/* Shared form notices from legacy pages */
.mk-form-page :is(.info-alert,.error-alert,.warning-box,.info-card,.signal-guidance-box) {
    margin: 0 0 1rem;
    padding: .95rem 1rem;
    border: 1px solid var(--mk-form-notice-line,#bfdbfe);
    border-radius: var(--mk-radius,8px);
    background: var(--mk-form-notice-bg,#eff6ff);
    color: var(--mk-form-notice-ink,#1e40af);
    box-shadow: none;
}
.mk-form-page :is(.info-alert,.error-alert,.warning-box,.info-card,.signal-guidance-box) :is(h3,strong,p) { margin-top: 0; }
.mk-form-page :is(.info-alert,.error-alert,.warning-box,.info-card,.signal-guidance-box) p { margin-bottom: 0; line-height: 1.6; }
.mk-form-page .error-alert { --mk-form-notice-line:#fecaca; --mk-form-notice-bg:#fef2f2; --mk-form-notice-ink:#991b1b; }
.mk-form-page .warning-box { --mk-form-notice-line:#fde68a; --mk-form-notice-bg:#fffbeb; --mk-form-notice-ink:#92400e; }
.mk-form-page .info-card,.mk-form-page .info-alert,.mk-form-page .signal-guidance-box { --mk-form-notice-line:#bfdbfe; --mk-form-notice-bg:#eff6ff; --mk-form-notice-ink:#1e40af; }
/* City guide sourced lodging and assignment data */
.city-reference-section{display:grid;gap:1rem;margin:1rem 0 1.25rem}.city-reference-section>.section-head{align-items:flex-end}.city-reference-section>.section-head p{margin:.3rem 0 0;color:var(--mk-muted,#64748b)}.city-reference-card{padding:1rem;border:1px solid var(--mk-line,#e4dfd7);border-radius:var(--mk-radius,8px);background:#fff;box-shadow:var(--mk-shadow-sm,0 8px 24px rgba(15,23,42,.06))}.city-reference-card__head{display:flex;align-items:center;gap:.75rem;margin-bottom:.9rem}.city-reference-card__head h3,.city-reference-card__head p{margin:0}.city-reference-card__head p{margin-top:.2rem;color:var(--mk-muted,#64748b);font-size:.88rem}.city-reference-card__icon{width:42px;height:42px;display:grid;place-items:center;border-radius:8px;background:#eef6ff;color:#2563eb}.city-reference-card__icon svg{width:22px;height:22px}.city-reference-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.65rem;margin:.75rem 0}.city-reference-metrics span{padding:.75rem;border:1px solid #e6eaf0;border-radius:8px;background:#f8fafc}.city-reference-metrics strong,.city-reference-metrics small{display:block}.city-reference-metrics small{margin-top:.2rem;color:#64748b}.city-housing-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.45rem}.city-housing-list div{display:flex;justify-content:space-between;gap:1rem;padding:.65rem .75rem;border:1px solid #e6eaf0;border-radius:8px;background:#f8fafc}.city-facility-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.65rem}.city-facility-item{display:grid;gap:.25rem;padding:.8rem;border:1px solid #e6eaf0;border-radius:8px;background:#f8fafc}.city-facility-item span,.city-facility-item small{color:#64748b}.city-facility-item small svg{width:14px;height:14px;vertical-align:-2px}.city-reference-warning{display:flex;align-items:flex-start;gap:.45rem;margin-top:.85rem;padding:.7rem .8rem;border:1px solid #fde68a;border-radius:8px;background:#fffbeb;color:#92400e;font-size:.9rem;line-height:1.5}.city-reference-warning svg{width:18px;height:18px;flex:0 0 auto;margin-top:.08rem}@media(max-width:760px){.city-reference-metrics,.city-housing-list,.city-facility-list{grid-template-columns:1fr}}

/* Shared form hero cascade lock: keep the back action readable and aligned. */
.mk-form-hero.page-hero {
    display: flex !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.mk-form-hero.page-hero .mk-form-hero__content {
    width: auto !important;
    max-width: none !important;
}

.mk-form-hero.page-hero .mk-form-hero__back,
.mk-form-hero.page-hero .mk-form-hero__back:link,
.mk-form-hero.page-hero .mk-form-hero__back:visited {
    width: auto !important;
    justify-self: end !important;
    border-color: #ffffff !important;
    background: #ffffff !important;
    color: #7f1d1d !important;
    -webkit-text-fill-color: #7f1d1d !important;
    text-decoration: none !important;
    text-shadow: none !important;
}

.mk-form-hero.page-hero .mk-form-hero__back :is(svg, span) {
    color: currentColor !important;
    -webkit-text-fill-color: currentColor !important;
}

.mk-form-hero.page-hero .mk-form-hero__back:hover,
.mk-form-hero.page-hero .mk-form-hero__back:focus-visible {
    border-color: #5f1515 !important;
    background: #5f1515 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.site-main > :is(.new-topic-page, .upload-document-page, .new-signal-page, .becayis-form-wrap, .cetele-form-page),
.mk-form-page {
    width: min(100% - (var(--page-gutter, 1rem) * 2), var(--content-wide, 1400px)) !important;
    max-width: var(--content-wide, 1400px) !important;
    margin-inline: auto !important;
}

.mk-form-page :is(.new-topic-container, .new-topic-wrapper, .upload-container, .upload-wrapper, .signal-form-shell) {
    width: 100% !important;
    max-width: 100% !important;
    margin-inline: 0 !important;
}

@media (max-width: 700px) {
    .mk-form-hero.page-hero {
        align-items: stretch !important;
        flex-direction: column !important;
    }

    .mk-form-hero.page-hero .mk-form-hero__back {
        width: 100% !important;
        justify-self: stretch !important;
    }
}
