/**
 * Cabinet Page — mostyfm
 * Personal account: layout, sidebar, panels, subscriptions, favorites, forms.
 */

/* ==========================================================================
   CABINET PAGE
   ========================================================================== */

.cabinet-page {
    padding: 40px 0 80px;
}

.cabinet-header {
    margin-bottom: 32px;
}

@media (max-width: 480px) {
    .cabinet-header .page-title {
        font-size: clamp(1.5rem, 7vw, 2.5rem);
        letter-spacing: -0.02em;
    }
}

.cabinet-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 768px) {
    .cabinet-layout {
        grid-template-columns: 1fr;
    }
}

/* =======================================================
   MOBILE: EDITOR TABS (under tab-bar, editors only)
   Vertical pill: icon top, text bottom (always visible)
   ======================================================= */

.cabinet-editor-tabs {
    display: none;
    align-items: stretch;
    gap: 4px;
    background: color-mix(in srgb, var(--color-surface) 80%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-pill);
    padding: 4px;
    margin-bottom: 24px;
    border: 1px solid var(--color-border);
    width: 100%;
}

/* Force buttons inside editor-tabs to fill available space equally */
.cabinet-editor-tabs .cabinet-nav-btn {
    flex: 1 1 0;
    width: 0;
}

.cabinet-editor-tabs .cabinet-editor-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 10px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem; /* 11px */
    font-weight: 500;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    text-align: center;
    min-width: 0;
    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

/* Text inside editor-tab — ALWAYS visible */
.cabinet-editor-tabs .cabinet-editor-tab span {
    display: block;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.cabinet-editor-tabs .cabinet-editor-tab:hover {
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-bg) 50%, transparent);
}

.cabinet-editor-tabs .cabinet-editor-tab.active {
    background: var(--color-surface);
    color: var(--color-accent);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-border);
    border-left: 1px solid var(--color-border); /* override .cabinet-nav-btn.active */
}

.cabinet-editor-tabs .cabinet-editor-tab svg {
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.cabinet-editor-tabs .cabinet-editor-tab:hover svg,
.cabinet-editor-tabs .cabinet-editor-tab.active svg {
    opacity: 1;
}

/* =======================================================
   MOBILE: BOTTOM TAB BAR (inline, icon-bar style)
   Icons evenly distributed, label appears BELOW on hover/active
   ======================================================= */

.cabinet-tab-bar {
    display: none; /* shown only on mobile via media query */
    margin-bottom: 16px;
    /* no position:fixed — stays in page flow */
}

/* Inactive buttons have fixed minimal width. Active/hovered button expands to use all remaining space. */
.cabinet-tab-bar-inner {
    display: flex;
    justify-content: center; /* keep centered if they don't fill */
    align-items: stretch;
    gap: 4px;
    padding: 4px;
    background: color-mix(in srgb, var(--color-surface) 80%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-soft);
    width: 100%;
}

.cabinet-tab-bar-inner .cabinet-nav-btn,
.cabinet-tab-bar-inner .cabinet-tab-pill {
    flex: 0 0 54px; /* minimal fixed width for inactive */
    width: 54px;
    transition: flex var(--transition-normal), width var(--transition-normal);
}

.cabinet-tab-bar-inner .cabinet-tab-pill:hover,
.cabinet-tab-bar-inner .cabinet-tab-pill.active {
    flex: 1 1 0; /* expands to fill remaining space */
    width: auto;
}

/* -------------------------------------------------------
   Vertical tab pill: icon top, label below on hover/active
   ------------------------------------------------------- */
.cabinet-tab-bar-inner .cabinet-tab-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 10px 10px 8px; /* equal left/right for minimum width circle */
    border-radius: var(--radius-pill); /* match outer container completely */
    font-size: 0.625rem;
    font-weight: 500;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    text-align: center;
    min-width: 0;
    /* No overflow:hidden — lets label animate freely */
    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        padding var(--transition-fast);
}

/* Label — hidden by default, appears below icon on hover/active */
.cabinet-tab-bar-inner .cabinet-tab-pill span {
    display: block;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    font-size: 0.625rem;
    line-height: 1;
    text-align: center;
    transition:
        max-height 0.25s ease,
        opacity 0.2s ease 0.05s;
}

/* Hover: show label (desktop) */
.cabinet-tab-bar-inner .cabinet-tab-pill:hover span {
    max-height: 20px;
    opacity: 1;
}

/* Active: soft accent tint across entire cell */
.cabinet-tab-bar-inner .cabinet-tab-pill.active {
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 10%, transparent);
    border-left: none; /* override .cabinet-nav-btn.active */
}

.cabinet-tab-bar-inner .cabinet-tab-pill.active span {
    max-height: 20px;
    opacity: 1;
}

.cabinet-tab-bar-inner .cabinet-tab-pill svg {
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
}

.cabinet-tab-bar-inner .cabinet-tab-pill:hover svg,
.cabinet-tab-bar-inner .cabinet-tab-pill.active svg {
    opacity: 1;
}

.cabinet-tab-bar-inner .cabinet-tab-pill:hover:not(.active) {
    color: var(--color-text);
    background: color-mix(in srgb, var(--color-bg) 50%, transparent);
}



/* Logout button variant */
.cabinet-tab-logout {
    color: var(--color-text-muted);
}

.cabinet-tab-logout:hover {
    color: var(--color-accent);
}



/* Sidebar */
.cabinet-sidebar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.cabinet-user-card {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.cabinet-avatar-wrap {
    width: 96px;
    height: 96px;
    margin: 0 auto 16px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--color-border);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.cabinet-avatar-wrap:hover .avatar-upload-overlay {
    opacity: 1;
}

.avatar-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
    border-radius: 50%;
    cursor: pointer;
    color: #fff;
}

.avatar-upload-overlay svg {
    width: 22px;
    height: 22px;
}

.cabinet-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cabinet-user-name {
    font-family: var(--font-sans);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}

.cabinet-user-role {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.cabinet-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
}

.cabinet-nav-sep {
    height: 1px;
    background: var(--color-border);
    margin: 8px 24px;
    opacity: 0.5;
}

.cabinet-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: var(--text-base);
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition-short);
}

.cabinet-nav-btn:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--color-text);
}

.cabinet-nav-btn.active {
    background: rgba(var(--color-accent-1-rgb), 0.1);
    color: var(--color-accent);
    border-left: 3px solid var(--color-accent);
}

.cabinet-nav-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.cabinet-nav-btn.active svg {
    opacity: 1;
}

.cabinet-nav-btn.logout-btn {
    margin-top: 12px;
    border-top: 1px solid var(--color-border);
    padding-top: 24px;
    color: var(--color-text-muted);
}

.cabinet-nav-btn.logout-btn:hover {
    color: var(--color-accent);
    background: transparent;
}

/* Content Area */
.cabinet-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px;
}

@media (max-width: 768px) {
    .cabinet-content {
        padding: 24px 16px;
        padding-bottom: 100px; /* room for fixed tab bar */
    }

    .cabinet-sidebar {
        display: none;
    }

    .cabinet-editor-tabs {
        display: flex;
    }

    .cabinet-tab-bar {
        display: flex;
    }
}

.cabinet-panel {
    display: none;
    animation: fadeIn var(--transition-short) ease;
}

.cabinet-panel.active {
    display: block;
}

.cabinet-page .settings-section h4 {
    font-size: var(--text-md);
    font-weight: 500;
    margin-bottom: var(--space-4);
    color: var(--color-text);
}

/* Subscriptions List */
.cabinet-subscriptions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: var(--space-4);
}

.subscription-item {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-short);
    -webkit-user-select: none;
    user-select: none;
}

.subscription-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.subscription-item input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.sub-checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border: 2px solid var(--color-text-muted);
    border-radius: 4px;
    background: transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.subscription-item:hover input~.sub-checkmark {
    border-color: var(--color-accent-1);
}

.subscription-item input:checked~.sub-checkmark {
    background-color: var(--color-accent-1);
    border-color: var(--color-accent-1);
}

.sub-checkmark:after {
    content: "";
    display: none;
}

.subscription-item input:checked~.sub-checkmark:after {
    display: block;
    width: 5px;
    height: 10px;
    border: solid #0a0a0c;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.sub-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
}

.cabinet-panel .panel-title {
    font-size: var(--text-xl);
    margin-bottom: 8px;
    color: var(--color-text);
}

.cabinet-panel .panel-desc {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* Forms */
.cabinet-form {
    max-width: 600px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: inherit;
    font-size: var(--text-base);
    transition: border-color var(--transition-short);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.form-actions {
    margin-top: 24px;
}

.cabinet-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    border-left: 3px solid transparent;
    background: transparent;
}

.cabinet-message.error {
    border-left-color: var(--color-accent-1);
    color: var(--color-accent-1);
    background: rgba(var(--color-accent-1-rgb), 0.06);
}

.cabinet-message.success {
    border-left-color: #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.06);
}

.settings-section {
    margin-bottom: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--color-border);
}

.settings-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.settings-section h4 {
    font-size: var(--text-lg);
    margin-bottom: 20px;
}

/* Empty States */
.cabinet-empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
}

.cabinet-empty-state .empty-icon {
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

.cabinet-empty-state p {
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* Favorites list */
.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.favorites-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--color-text);
    transition: border-color var(--transition-short), background var(--transition-short);
}

.favorites-item:hover {
    border-color: var(--color-accent);
    background: rgba(var(--color-accent-1-rgb), 0.03);
}

.favorites-thumb {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    border-radius: var(--radius-xs);
    overflow: hidden;
}

.favorites-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.favorites-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.favorites-title {
    font-size: var(--text-sm);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.favorites-date {
    font-size: var(--text-xs);
}

.favorites-unlike {
    margin-left: auto;
    flex-shrink: 0;
}

/* =============================================
   EMAIL SWITCH (подписки)
   ============================================= */

.cabinet-email-switch {
    margin-bottom: 24px;
    padding: 16px 20px;
    background: rgba(var(--color-accent-2-rgb), 0.07);
    border-radius: var(--radius-md);
    border: 1px solid rgba(var(--color-accent-2-rgb), 0.2);
}

.cabinet-email-switch .subscription-item {
    margin-bottom: 0;
}

.cabinet-email-switch .sub-label {
    font-weight: 600;
    color: var(--color-text);
}

.cabinet-email-switch .sub-email-hint {
    margin: 6px 0 0 33px;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    line-height: 1.5;
}

/* Заголовок секции подписок */
.subscriptions-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 16px;
    margin-top: 4px;
}

/* =============================================
   AVATAR UPLOAD SPNNER
   ============================================= */

.avatar-uploading .avatar-upload-overlay {
    opacity: 1;
}

.avatar-upload-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ==========================================================================
   EDITORIAL DASHBOARD
   ========================================================================== */

/* Controls Bar */
.editorial-controls {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.editorial-filters {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.editorial-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.editorial-filter-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.editorial-select,
.editorial-input {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.75rem;
    font-family: inherit;
    transition: border-color var(--transition-short);
}

.editorial-select {
    padding: 8px 32px 8px 12px;
    background: var(--color-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    cursor: pointer;
    min-width: 150px;
}

.editorial-input {
    padding: 8px 12px;
    background: var(--color-bg);
    min-width: 220px;
}

.editorial-select:focus,
.editorial-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.editorial-select--sm {
    min-width: 80px;
}

.editorial-meta {
    display: flex;
    align-items: flex-end;
    gap: var(--space-4);
}

.editorial-per-page-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.editorial-total {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    padding-bottom: 9px;
}

/* Table Scroll Wrapper (horizontal scroll on mobile) */
.editorial-table-wrap {
    min-height: 120px;
}

.editorial-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

/* Table */
.editorial-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    min-width: 700px;
}

.editorial-table thead {
    background: var(--color-bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.editorial-table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.editorial-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.editorial-table th.sortable:hover {
    color: var(--color-text);
}

.editorial-table th.sort-active {
    color: var(--color-accent);
}

.sort-icon {
    font-size: 0.85em;
    margin-left: 4px;
}

.editorial-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
    color: var(--color-text);
}

.editorial-table tbody tr {
    transition: background var(--transition-short);
}

.editorial-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

.editorial-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column widths */
.editorial-table .col-date {
    white-space: nowrap;
    color: var(--color-text-muted);
}

.editorial-table .col-num {
    text-align: center;
    width: 44px;
    color: var(--color-text-muted);
}

.editorial-table .col-author {
    white-space: nowrap;
    color: var(--color-text-muted);
}

.editorial-table .col-actions {
    width: 72px;
    text-align: center;
    white-space: nowrap;
}

.editorial-title-cell {
    max-width: 260px;
}

.editorial-title-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    line-height: 1.4;
    font-weight: 500;
}

/* Tooltip Wrap */
.editorial-title-tooltip-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.editorial-title-tooltip-wrap::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    padding: 6px 10px;
    background-color: var(--editorial-tooltip-bg, var(--color-text));
    color: var(--editorial-tooltip-color, var(--color-surface));
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: all 0.2s ease;
    z-index: 100;
    pointer-events: none;
    width: max-content;
    max-width: 250px;
}

.editorial-title-tooltip-wrap:hover::after,
.editorial-title-tooltip-wrap:active::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.editorial-theme-cell {
    max-width: 180px;
}

.editorial-empty-val {
    color: var(--color-text-muted);
    opacity: 0.5;
}

/* Theme Adaptive Variables for Editorial UI */
:root {
    --editorial-badge-section-bg: rgba(var(--color-accent-1-rgb), 0.1);
    --editorial-badge-section-color: var(--color-accent-1);
    --editorial-badge-section-border: rgba(var(--color-accent-1-rgb), 0.25);

    --editorial-badge-theme-bg: rgba(var(--color-accent-1-rgb), 0.1);
    --editorial-badge-theme-color: var(--color-accent-1);
    --editorial-badge-theme-border: rgba(var(--color-accent-1-rgb), 0.25);

    --editorial-status-draft-bg: #f0f0f2;
    --editorial-status-draft-color: var(--color-text-muted);

    --editorial-status-pending-color: #d86900;

    --editorial-ms-menu-bg: #ffffff;
    --editorial-ms-menu-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] {
    --editorial-badge-section-bg: rgba(var(--color-accent-1-rgb), 0.1);
    --editorial-badge-section-color: var(--color-accent-1);
    --editorial-badge-section-border: rgba(var(--color-accent-1-rgb), 0.25);

    --editorial-badge-theme-bg: rgba(var(--color-accent-1-rgb), 0.1);
    --editorial-badge-theme-color: var(--color-accent-1);
    --editorial-badge-theme-border: rgba(var(--color-accent-1-rgb), 0.25);

    --editorial-status-draft-bg: rgba(255, 255, 255, 0.05);
    --editorial-status-draft-color: var(--color-text-muted);

    --editorial-status-pending-color: var(--color-accent);

    --editorial-ms-menu-bg: var(--color-surface-elevated, #2a2a32);
    --editorial-ms-menu-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);

    --editorial-tooltip-bg: var(--color-surface-elevated, #2a2a32);
    --editorial-tooltip-color: var(--color-text);
}

/* Badges */
.editorial-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* Select Badges Base (Status, Section, Theme) */
.editorial-status-select,
.editorial-badge-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: transparent;
    color: inherit;
    border: none;
    padding: 2px 20px 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="12" viewBox="0 0 24 24" width="12" xmlns="http://www.w3.org/2000/svg"><path d="M6 9L12 15L18 9" stroke="%238a8a93" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/></svg>');
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: filter 0.2s ease, opacity 0.2s ease;
    max-width: 100%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.editorial-status-select:hover,
.editorial-badge-select:hover {
    filter: brightness(1.2);
}

.editorial-status-select:disabled,
.editorial-badge-select:disabled,
.editorial-badge-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Custom Multi-Select Dropdown */
.editorial-ms-wrap {
    position: relative;
    display: inline-block;
}

.editorial-badge-btn {
    appearance: none;
    -webkit-appearance: none;
    background-color: transparent;
    color: inherit;
    border: none;
    padding: 2px 20px 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="12" viewBox="0 0 24 24" width="12" xmlns="http://www.w3.org/2000/svg"><path d="M6 9L12 15L18 9" stroke="%238a8a93" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/></svg>');
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: filter 0.2s ease, opacity 0.2s ease;
    max-width: 150px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.editorial-badge-btn:hover {
    filter: brightness(1.2);
}

/* Color Modifiers (must be after base classes to override background-color) */
.editorial-badge--section {
    background-color: var(--editorial-badge-section-bg);
    color: var(--editorial-badge-section-color);
    border: 1px solid var(--editorial-badge-section-border);
}

.editorial-badge--theme {
    background-color: var(--editorial-badge-theme-bg);
    color: var(--editorial-badge-theme-color);
    border: 1px solid var(--editorial-badge-theme-border);
}

.status-published {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.status-draft {
    background-color: var(--editorial-status-draft-bg);
    color: var(--editorial-status-draft-color);
    border: 1px solid var(--color-border);
}

.status-pending {
    background-color: rgba(var(--color-accent-1-rgb), 0.1);
    color: var(--editorial-status-pending-color);
    border: 1px solid rgba(var(--color-accent-1-rgb), 0.25);
}

/* End of Color Modifiers */

.editorial-ms-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--editorial-ms-menu-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--editorial-ms-menu-shadow, 0 4px 12px rgba(0, 0, 0, 0.4));
    min-width: 160px;
    z-index: 50;
    overflow: hidden;
    animation: fade_in 0.2s ease;
}

.editorial-ms-list {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
}

.editorial-ms-item {
    font-size: 0.75rem;
    padding: 6px 12px 6px 28px;
    cursor: pointer;
    color: var(--color-text);
    transition: background 0.2s ease;
    position: relative;
    user-select: none;
}

.editorial-ms-item:hover {
    background: rgba(var(--color-accent-1-rgb), 0.1);
}

.editorial-ms-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    background: transparent;
    transition: all 0.2s ease;
}

.editorial-ms-item.selected::before {
    background: var(--color-accent);
    border-color: var(--color-accent);
    background-image: url('data:image/svg+xml;utf8,<svg fill="none" height="10" viewBox="0 0 24 24" width="10" xmlns="http://www.w3.org/2000/svg"><path d="M20 6L9 17L4 12" stroke="white" stroke-linecap="round" stroke-linejoin="round" stroke-width="3"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.editorial-ms-actions {
    padding: 12px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
    text-align: center;
}

.editorial-ms-actions .btn {
    width: auto;
    padding-top: 6px;
    padding-bottom: 6px;
    padding-left: 24px;
    padding-right: 24px;
}

.editorial-status-select.status-published {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.editorial-status-select.status-draft {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.editorial-status-select.status-pending {
    background-color: rgba(var(--color-accent-1-rgb), 0.1);
    color: var(--color-accent);
    border: 1px solid rgba(var(--color-accent-1-rgb), 0.25);
}

.editorial-status-select.status-trash {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Action Buttons */
.editorial-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    transition: color var(--transition-short), border-color var(--transition-short), background var(--transition-short);
    text-decoration: none;
}

.editorial-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

.editorial-action-edit:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
}

.editorial-action-view:hover {
    color: var(--color-accent-primary);
    border-color: var(--color-accent-primary);
}

/* Loading */
.editorial-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-10) 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.editorial-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

.editorial-empty,
.editorial-error {
    padding: var(--space-8);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
}

.editorial-error {
    color: var(--color-accent);
    border-color: rgba(var(--color-accent-1-rgb), 0.3);
}

/* Pagination */
.editorial-pagination {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-5);
}

.editorial-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-short);
}

.editorial-page-btn:hover:not([disabled]) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    border-color: var(--color-text-muted);
}

.editorial-page-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-bg);
    font-weight: 700;
    cursor: default;
}

.editorial-page-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.editorial-page-dots {
    color: var(--color-text-muted);
    padding: 0 4px;
    font-size: var(--text-sm);
}

/* ── Mobile Cards ── */
.editorial-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.editorial-card {
    position: relative;
    z-index: 1;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.editorial-card:hover {
    border-color: var(--color-border-hover);
    transform: translateY(-2px);
}

.editorial-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-3);
}

.editorial-card-title {
    font-family: var(--font-family-serif);
    font-size: var(--text-lg);
    line-height: 1.3;
    font-weight: 500;
    color: var(--color-text);
}

.editorial-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.editorial-card-date {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-left: auto;
}

.editorial-card-footer {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.editorial-card-author {
    color: var(--color-text);
    font-weight: 500;
}

.editorial-card-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.editorial-card-actions {
    margin-left: auto;
    display: flex;
    gap: var(--space-2);
}

/* ── Адаптивность ── */
@media (max-width: 992px) {
    .editorial-filters {
        flex-wrap: wrap;
    }

    .editorial-filter-group {
        flex: 1 1 calc(33.333% - var(--space-3));
        min-width: 140px;
    }
}

@media (max-width: 768px) {
    .editorial-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .editorial-filters {
        flex-direction: column;
        width: 100%;
    }

    .editorial-filter-group {
        width: 100%;
        max-width: 100%;
    }

    .editorial-select {
        width: 100%;
    }

    .editorial-meta {
        width: 100%;
        justify-content: space-between;
        margin-top: var(--space-2);
    }
}

/* ==========================================================================
   SOURCES TAB
   ========================================================================== */

.sources-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.sources-add-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 16px;
    background: var(--color-accent);
    color: var(--color-bg);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    flex-shrink: 0;
}

.sources-add-btn:hover {
    opacity: 0.88;
}

/* Filters */
.sources-filters {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

.sources-filter-search {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.sources-filter-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.sources-search-input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.8125rem;
    transition: border-color var(--transition-fast);
}

.sources-search-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.sources-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 8px 32px 8px 12px;
    background: var(--color-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    min-width: 140px;
    transition: border-color var(--transition-fast);
}

.sources-select:focus {
    outline: none;
    border-color: var(--color-accent);
}

/* Table */
.sources-table-wrap {
    min-height: 80px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sources-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    min-width: 640px;
}

.sources-table thead {
    background: var(--color-bg);
}

.sources-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.sources-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    color: var(--color-text);
}

.sources-table tbody tr:hover {
    background: rgba(var(--color-accent-1-rgb), 0.03);
}

.sources-table tbody tr:last-child td {
    border-bottom: none;
}

.sources-col-actions {
    width: 80px;
    text-align: right;
}

.sources-td-url a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    max-width: 180px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--transition-fast);
}

.sources-td-url a:hover {
    color: var(--color-accent);
}

.sources-td-comment {
    max-width: 220px;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sources-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(var(--color-accent-1-rgb), 0.1);
    color: var(--color-accent-1);
    border: 1px solid rgba(var(--color-accent-1-rgb), 0.2);
    white-space: nowrap;
}

.sources-empty-val {
    color: var(--color-text-muted);
    opacity: 0.4;
    font-style: italic;
}

.sources-action-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
    line-height: 0;
}

.sources-action-btn:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.07);
}

.sources-action-btn.delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.sources-actions-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
}

.sources-loading,
.sources-empty {
    padding: 40px;
    text-align: center;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    font-size: 0.9rem;
}

.sources-loading[hidden],
.sources-empty[hidden] {
    display: none !important;
}


/* Modal */
.sources-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9500;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.sources-modal-overlay[hidden] {
    display: none;
}

.sources-modal-box {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-6);
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

.sources-modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
}

.sources-modal-close:hover {
    background: var(--color-text);
    color: var(--color-surface);
}

.sources-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-5);
    color: var(--color-text);
}

.sources-form-msg {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: var(--space-4);
}

.sources-form-msg[hidden] {
    display: none;
}

.sources-form-msg.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.sources-form-msg.success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* Buttons */
.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition-fast), background var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--color-text);
    color: var(--color-surface);
}

.btn-primary:hover {
    opacity: 0.85;
}

.btn-secondary {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.form-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.form-group .required {
    color: var(--color-accent);
}

/* Adaptive */
@media (max-width: 768px) {
    .sources-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .sources-filters {
        flex-direction: column;
    }

    .sources-filter-search,
    .sources-select {
        width: 100%;
        min-width: unset;
    }
}

/* Date column */
.sources-col-date {
    width: 110px;
    white-space: nowrap;
}

.sources-td-date {
    width: 110px;
    white-space: nowrap;
}

.sources-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* Clone button */
.sources-action-btn.clone-src:hover {
    color: var(--color-accent);
}

/* ── Sources Card Grid ─────────────────────────────────────────── */

.sources-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    padding: var(--space-2) 0;
}

.sources-grid[hidden] {
    display: none !important;
}

.source-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.source-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-sm);
}

/* Header: name + actions */
.source-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2);
}

.source-card__name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.3;
    flex: 1;
}

/* URL */
.source-card__url-row {
    margin-top: var(--space-1);
}

.source-card__url {
    font-size: 0.78rem;
    color: var(--color-accent);
    text-decoration: none;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.source-card__url:hover {
    text-decoration: underline;
}

/* Badges */
.source-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-top: var(--space-1);
}

/* Comment */
.source-card__comment {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer: author + dates */
.source-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
}

.source-card__author {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.source-card__author svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.source-card__dates {
    font-size: 0.72rem;
    color: var(--color-text-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

@media (max-width: 768px) {
    .sources-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   IDEAS (РАЗВИТИЕ) — вкладка предложений по развитию сайта
   ========================================================================== */

/* ── Шапка вкладки ── */
.ideas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.ideas-add-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 9px 18px;
    background: var(--color-accent-1);
    color: var(--color-bg);
    border: none;
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity var(--transition-short);
    flex-shrink: 0;
}

.ideas-add-btn:hover {
    opacity: 0.85;
}

/* ── Фильтры ── */
.ideas-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.ideas-filter-btn {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-short);
}

.ideas-filter-btn:hover {
    border-color: var(--color-accent-1);
    color: var(--color-accent-1);
}

.ideas-filter-btn.active {
    background: var(--color-accent-1);
    border-color: var(--color-accent-1);
    color: var(--color-bg);
}

/* ── Список ── */
.ideas-list-wrap {
    min-height: 80px;
}

.ideas-loading {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-6) 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.ideas-loading[hidden] {
    display: none !important;
}

.ideas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-5);
}

.ideas-grid[hidden] {
    display: none !important;
}

.ideas-empty {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.ideas-empty[hidden] {
    display: none !important;
}

.ideas-empty .empty-icon {
    display: block;
    margin: 0 auto var(--space-3);
    opacity: 0.4;
}

/* ── Карточка идеи ── */
.idea-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-short), box-shadow var(--transition-short);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.idea-card:hover {
    border-color: rgba(var(--color-accent-1-rgb), 0.35);
    box-shadow: var(--shadow-sm);
}

.idea-card__images {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
    margin-bottom: var(--space-2);
}

.idea-card__thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    display: block;
    background: var(--color-bg);
}

.idea-card__body {
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* ── Шапка карточки (статус + кнопки) ── */
.idea-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.idea-card__meta-top {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    min-width: 0;
}

.idea-card__actions {
    display: flex;
    gap: var(--space-1);
    flex-shrink: 0;
}

.ideas-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-short);
}

.ideas-action-btn:hover {
    background: rgba(255,255,255,0.07);
    color: var(--color-text);
}

.ideas-action-btn.idea-delete-btn:hover {
    color: #ef4444;
}

/* ── Статус бейджи ── */
.idea-status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.idea-status--yellow {
    background: rgba(234, 179, 8, 0.12);
    color: #ca8a04;
}
[data-theme="dark"] .idea-status--yellow {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
}

.idea-status--blue {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}
[data-theme="dark"] .idea-status--blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.idea-status--orange {
    background: rgba(var(--color-accent-1-rgb), 0.12);
    color: var(--color-accent-1);
}

.idea-status--red {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}
[data-theme="dark"] .idea-status--red {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.idea-status--green {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}
[data-theme="dark"] .idea-status--green {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

/* ── Select статуса (admin) ── */
.idea-status-select {
    appearance: none;
    -webkit-appearance: none;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.7rem;
    padding: 3px 8px;
    cursor: pointer;
    transition: border-color var(--transition-short);
}

.idea-status-select:focus {
    outline: none;
    border-color: var(--color-accent-1);
}

/* ── Контент карточки ── */
.idea-card__title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: var(--space-2);
}

.idea-card__excerpt {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-3);
}

/* ── Футер карточки ── */
.idea-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-top: auto;
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.idea-card__author {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.75rem;
    color: var(--color-text-muted);
    min-width: 0;
    overflow: hidden;
}

.idea-card__author span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.idea-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.idea-card__date {
    opacity: 0.6;
    font-size: 0.7rem;
}

/* ── Кнопка комментариев ── */
.idea-comments-btn {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-short);
    flex-shrink: 0;
}

.idea-comments-btn:hover {
    border-color: var(--color-accent-1);
    color: var(--color-accent-1);
}

/* ── Секция комментариев ── */
.idea-comments-section {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--color-border);
}

.idea-comments-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.idea-no-comments {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
    padding: var(--space-3) 0;
}

.idea-comment-item {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
}

.idea-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.idea-comment-content {
    flex: 1;
    min-width: 0;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    padding: var(--space-2) var(--space-3);
}

.idea-comment-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: 4px;
}

.idea-comment-header strong {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text);
}

.idea-comment-date {
    font-size: 0.68rem;
    color: var(--color-text-muted);
}

.idea-comment-content p {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin: 0;
}

.idea-comment-form {
    margin-top: var(--space-2);
}

.idea-comment-input-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 6px;
    transition: border-color var(--transition-short);
    min-width: 0;
    overflow: hidden;
}

.idea-comment-input-wrap:focus-within {
    border-color: var(--color-accent-1);
}

.idea-comment-input-row {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    min-width: 0; /* предотвращает overflow flex-контейнера */
    flex-wrap: wrap;
}


.idea-comment-attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-short);
}

.idea-comment-attach-btn:hover {
    color: var(--color-accent-1);
    background: rgba(var(--color-accent-1-rgb), 0.1);
}

.idea-comment-file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
}

.idea-comment-file-name {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.idea-comment-file-remove {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
}
.idea-comment-file-remove:hover {
    color: #ef4444;
}

.idea-comment-photo {
    margin-top: var(--space-2);
}


.idea-comment-input {
    flex: 1;
    padding: 8px 4px;
    background: transparent;
    border: none;
    color: var(--color-text);
    font-family: inherit;
    font-size: var(--text-sm);
    min-width: 140px;
}

.idea-comment-input:focus {
    outline: none;
}

.idea-comment-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: var(--color-accent-1);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-bg);
    cursor: pointer;
    transition: opacity var(--transition-short);
    margin-left: auto;
}

.idea-comment-submit:hover {
    opacity: 0.85;
}

.idea-comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Load more ── */
.ideas-load-more-wrap {
    text-align: center;
    margin-top: var(--space-5);
}

.ideas-load-more-btn {
    padding: 10px 28px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    color: var(--color-text-muted);
    font-family: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--transition-short);
}

.ideas-load-more-btn:hover {
    border-color: var(--color-accent-1);
    color: var(--color-accent-1);
}

/* ── Модальное окно ── */
.ideas-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 9800;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    backdrop-filter: blur(4px);
}
.ideas-modal-overlay:not([hidden]) {
    display: flex;
}

.ideas-modal-box {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.ideas-modal-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-5);
    padding-right: var(--space-6);
}

.ideas-modal-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-short);
}

.ideas-modal-close:hover {
    background: rgba(255,255,255,0.07);
    color: var(--color-text);
}

/* ── Upload area ── */
.ideas-upload-area {
    position: relative;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color var(--transition-short);
    overflow: hidden;
}

.ideas-upload-area:hover {
    border-color: var(--color-accent-1);
}

.ideas-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.ideas-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    padding: var(--space-4);
    text-align: center;
    pointer-events: none;
}

.ideas-image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.ideas-image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-bg);
}

.ideas-image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ideas-image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0,0,0,0.65);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-short);
    z-index: 2;
}

.ideas-image-preview-remove:hover {
    background: rgba(239,68,68,0.9);
}

/* ── Form message ── */
.ideas-form-msg {
    margin-top: var(--space-3);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    font-weight: 500;
    border-left: 3px solid transparent;
}

.ideas-form-msg.success {
    border-left-color: #22c55e;
    color: #16a34a;
    background: rgba(34,197,94,0.07);
}
[data-theme="dark"] .ideas-form-msg.success {
    color: #4ade80;
}

.ideas-form-msg.error {
    border-left-color: var(--color-accent-1);
    color: var(--color-accent-1);
    background: rgba(var(--color-accent-1-rgb), 0.07);
}

/* ── Ideas form (overrides cabinet-form max-width) ── */
#ideas-form.cabinet-form {
    max-width: 100%;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ideas-grid {
        grid-template-columns: 1fr;
    }
    .ideas-modal-box {
        padding: var(--space-4);
    }
}

/* ── [hidden] оверрайды ── */
.ideas-modal-overlay[hidden] {
    display: none !important;
}

.ideas-upload-placeholder[hidden] {
    display: none !important;
}

/* ── View Modal ── */
.ideas-view-box {
    max-width: 640px;
}

.ideas-view-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.ideas-view-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.ideas-view-author {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.ideas-view-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.35;
    margin: 0;
}

.ideas-view-img {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
}

.ideas-view-body {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.7;
    padding-top: var(--space-2);
    border-top: 1px solid var(--color-border);
}

.ideas-view-body p {
    margin-bottom: var(--space-3);
}

.ideas-view-body p:last-child {
    margin-bottom: 0;
}

.ideas-view-comments {
    margin-top: var(--space-5);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.ideas-view-comments h4 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-4);
}

/* ── Лайтбокс идей (миниатюры -> фуллсайз) ── */
.ideas-view-images {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.ideas-view-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    background: var(--color-bg);
    transition: opacity 0.2s;
}

.ideas-view-thumb:hover {
    opacity: 0.8;
}

.ideas-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 1;
    transition: opacity 0.2s;
}

.ideas-lightbox[hidden] {
    display: none !important;
}

.ideas-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
}

.ideas-lightbox-close {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}

.ideas-lightbox-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

@media (max-width: 768px) {
    .ideas-view-box {
        max-width: 100%;
    }
}