:root,
[data-theme="dark"] {
    --bg: #0f1419;
    --bg-gradient: #1e293b;
    --surface: #1a2332;
    --surface-hover: #243044;
    --border: #2d3a4f;
    --text: #e8edf4;
    --text-muted: #8b9cb3;
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.15);
    --success: #22c55e;
    --success-text: #052e16;
    --danger: #ef4444;
    --tr-color: #fbbf24;
    --de-color: #60a5fa;
    --radius: 16px;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    --topbar-bg: rgba(15, 20, 25, 0.85);
    --selection-bg: rgba(59, 130, 246, 0.35);
}

[data-theme="light"] {
    --bg: #f0f4f8;
    --bg-gradient: #dbeafe;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #cbd5e1;
    --text: #1e293b;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.12);
    --success: #16a34a;
    --success-text: #ffffff;
    --tr-color: #b45309;
    --de-color: #1d4ed8;
    --shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
    --topbar-bg: rgba(255, 255, 255, 0.92);
    --selection-bg: rgba(37, 99, 235, 0.25);
}

* {
    box-sizing: border-box;
}

::selection {
    background: var(--selection-bg);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background:
        radial-gradient(ellipse at top, var(--bg-gradient) 0%, transparent 55%),
        var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.topbar {
    border-bottom: 1px solid var(--border);
    background: var(--topbar-bg);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.05rem;
    min-width: 0;
}

.brand-link {
    color: inherit;
    text-decoration: none;
}

.brand-link:hover {
    color: var(--accent);
}

.topbar-nav {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.nav-slot {
    width: 72px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.nav-slot-home {
    width: 72px;
}

.nav-slot-wide {
    width: auto;
    min-width: 72px;
    padding: 0 2px;
}

.nav-slot-wide .nav-link {
    white-space: nowrap;
    font-size: 0.88rem;
}

.nav-slot.nav-dropdown {
    width: auto;
    position: relative;
}

.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

.nav-dropdown-toggle.is-open {
    color: var(--accent);
    background: var(--accent-soft);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 150px;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 30;
}

.nav-dropdown-item {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-dropdown-item.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-slot.nav-user {
    width: auto;
    gap: 6px;
    padding: 0 6px;
}

.nav-user-link {
    position: relative;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    max-width: 220px;
    overflow: visible;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}

.nav-user-name {
    color: var(--accent);
    font-weight: 600;
}

.nav-user-link:hover,
.nav-user-link:focus-visible {
    background: var(--accent-soft);
    color: var(--text);
}

.nav-user-link.is-active {
    background: var(--accent-soft);
    color: var(--text);
}

.nav-user-link[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.3;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 40;
}

.nav-user-link:hover::after,
.nav-user-link:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.nav-link-muted {
    font-size: 0.85rem;
    padding: 4px 8px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-link.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.btn-theme {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-theme:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.home-layout {
    display: flex;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    min-height: calc(100vh - 57px);
    align-items: stretch;
}

.home-main {
    flex: 1;
    min-width: 0;
    padding: 40px 32px 48px;
}

.home-title {
    margin: 0 0 8px;
    font-size: 1.6rem;
}

.home-desc {
    color: var(--text-muted);
    margin: 0;
}

.home-notes {
    margin-top: 5em;
}

.home-notes-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.home-notes-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.home-notes-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-notes-empty {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.home-note-wrap {
    list-style: none;
}

.home-note-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 12px 14px;
}

.home-note-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-note-summary::-webkit-details-marker {
    display: none;
}

.home-note-summary::before {
    content: '▸';
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.home-note-item[open] .home-note-summary::before {
    transform: rotate(90deg);
}

.home-note-title {
    font-weight: 600;
    min-width: 0;
    word-break: break-word;
}

.home-note-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.home-note-content {
    margin-bottom: 12px;
}

.home-note-message {
    margin: 0 0 8px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.95rem;
}

.home-note-link {
    display: inline-block;
    font-size: 0.9rem;
    word-break: break-all;
}

.home-note-compose-input {
    min-height: 88px;
}

.home-note-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.home-note-comments-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.home-note-comment-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-note-comment {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg);
}

.home-note-comment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.home-note-comment-actions {
    display: inline-flex;
    gap: 6px;
    flex-shrink: 0;
}

.home-note-comment-body {
    margin: 0;
    font-size: 0.92rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.home-note-comment-input {
    min-height: 88px;
}

/* Files page */
.files-page .users-page-head {
    margin-bottom: 4px;
}

.files-upload-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.team-files-list {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-files-empty {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.team-file-wrap {
    list-style: none;
}

.team-file-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 12px 14px;
}

.team-file-summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.team-file-summary::-webkit-details-marker {
    display: none;
}

.team-file-summary::before {
    content: '▸';
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-right: 4px;
    transition: transform 0.15s ease;
}

.team-file-item[open] .team-file-summary::before {
    transform: rotate(90deg);
}

.team-file-name {
    font-weight: 600;
    min-width: 0;
    word-break: break-word;
    flex: 1;
}

.team-file-download {
    flex-shrink: 0;
    text-decoration: none;
}

.team-file-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.team-file-meta {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.team-file-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.team-file-comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-file-comments-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.team-file-comment {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg);
}

.team-file-comment-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.team-file-comment-actions {
    display: inline-flex;
    gap: 6px;
    flex-shrink: 0;
}

.team-file-comment-body {
    margin: 0;
    font-size: 0.92rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.home-aside {
    width: 168px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 20px 8px 28px 0;
    margin-right: 12px;
    border-left: 1px solid var(--border);
}

.admin-aside {
    width: 248px;
    margin-right: 20px;
    min-height: calc(100vh - 57px);
}

.admin-side-nav-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.list-panel {
    width: 100%;
}

.list-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 10px;
    padding: 0 2px;
}

.list-sidebar-title {
    margin: 0;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.list-menu-compact .list-menu-item {
    padding: 6px 8px;
    border-radius: 8px;
}

.list-menu-compact .list-menu-name {
    font-size: 0.8rem;
}

.list-menu-compact .list-menu-count {
    font-size: 0.68rem;
    padding: 1px 6px;
}

.meine-list-menu-item {
    flex-wrap: wrap;
    gap: 4px 6px;
}

.meine-list-menu-item .list-menu-name {
    flex: 1 1 auto;
    min-width: 0;
}

.meine-card-view-btn {
    flex-shrink: 0;
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--bg);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 6px;
    padding: 2px 6px;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
}

.meine-card-view-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.meine-card-panel .card-toolbar-inner {
    justify-content: center;
}

.meine-card-hint {
    text-align: center;
    margin-top: 0;
}

.list-menu-item-export {
    flex-wrap: nowrap;
    gap: 4px;
    cursor: pointer;
}

.list-menu-item-export .list-menu-name {
    flex: 1;
    min-width: 0;
}

.list-menu-item-export .list-menu-count {
    flex-shrink: 0;
}

.list-export-link {
    flex-shrink: 0;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    padding: 2px 5px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    white-space: nowrap;
    transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.list-export-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.list-sidebar-hint {
    margin: 10px 2px 0;
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.btn-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--accent);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-icon:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.list-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.list-menu-item:hover {
    background: var(--surface-hover);
}

.list-menu-item.is-active {
    background: var(--accent-soft);
    border-color: rgba(59, 130, 246, 0.35);
}

.list-menu-name {
    font-size: 0.95rem;
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-menu-name.is-editing {
    outline: 1px solid var(--accent);
    border-radius: 4px;
    padding: 0 4px;
    background: var(--bg);
    white-space: normal;
}

.list-menu-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

.admin-layout {
    display: flex;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    min-height: calc(100vh - 57px);
    align-items: stretch;
}

.admin-center {
    flex: 1;
    min-width: 0;
    padding: 28px 24px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.admin-placeholder {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 80px;
}

.admin-panel {
    width: 100%;
    max-width: 640px;
}

.admin-list-label {
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

.admin-side-nav {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.admin-side-link {
    display: block;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
}

.admin-side-link + .admin-side-link {
    margin-top: 4px;
}

.admin-side-link:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.admin-side-link.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.admin-side-link-with-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.nav-link-with-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-slot-badge {
    width: auto;
}

.admin-feedback-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    animation: feedback-badge-pulse 1.6s ease-in-out infinite;
}

@keyframes feedback-badge-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55);
    }
    50% {
        opacity: 0.88;
        box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);
    }
}

.admin-todos-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 5px;
    border-radius: 999px;
    background: #f59e0b;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
}

.admin-comments-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 5px;
    border-radius: 999px;
    background: #3b82f6;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    animation: comments-badge-pulse 1.6s ease-in-out infinite;
}

@keyframes comments-badge-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55);
    }
    50% {
        opacity: 0.88;
        box-shadow: 0 0 0 5px rgba(59, 130, 246, 0);
    }
}

.admin-comments-groups {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 16px;
}

.admin-comments-list-group {
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    background: var(--surface);
    overflow: hidden;
}

.admin-comments-list-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0;
    padding: 12px 16px;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.admin-comments-list-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
}

.admin-comments-card-list {
    list-style: none;
    margin: 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-comments-card-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}

.admin-comments-card-item.is-new {
    border-color: rgba(59, 130, 246, 0.45);
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.admin-comments-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.admin-comments-new-pill {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    font-size: 0.72rem;
    font-weight: 700;
    animation: comments-badge-pulse 1.6s ease-in-out infinite;
}

.admin-comments-new-label {
    color: #3b82f6;
    font-weight: 700;
}

.admin-comments-card-tr {
    margin: 0 0 4px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
}

.admin-comments-card-de {
    margin: 0 0 10px;
    color: var(--text-muted);
    line-height: 1.4;
}

.admin-comments-card-preview {
    margin-bottom: 12px;
}

.admin-comments-card-meta .admin-comments-card-actions {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-comments-thread {
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-comment-item {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.admin-comment-item[data-depth="1"],
.admin-comment-children .admin-comment-item {
    margin-left: 16px;
}

.admin-comment-children {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.admin-comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.admin-comment-score {
    font-weight: 700;
    color: var(--accent);
}

.admin-comments-card-item .comment-text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.admin-comments-card-item .comments-empty {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.admin-list-panel {
    margin-top: 4px;
}

.admin-table-panel {
    max-width: 100%;
}

.admin-table-title {
    margin: 0 0 16px;
    font-size: 1.1rem;
}

.sentence-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

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

.sentence-table th,
.sentence-table td {
    border: 1px solid var(--border);
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    line-height: 1.45;
}

.sentence-table th {
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sentence-table tbody tr:nth-child(even) {
    background: rgba(128, 128, 128, 0.04);
}

.sentence-table tbody tr.is-learned td {
    opacity: 0.55;
}

.sentence-table td {
    white-space: pre-line;
}

.sentence-table td:first-child {
    width: 50%;
    color: var(--tr-color);
}

.sentence-table td:last-child {
    width: 50%;
    color: var(--de-color);
}

.cell-empty {
    color: var(--text-muted);
    font-style: italic;
}

.sentence-table-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 24px !important;
}

.admin-table-empty {
    margin: 16px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stats,
.admin-stats {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.stats-row .stats {
    margin-bottom: 0;
}

.stats-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-reset.is-active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-reset:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.btn-reset.is-active:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-reset:disabled {
    opacity: 0.5;
    cursor: wait;
}

.card-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    position: sticky;
    top: 57px;
    z-index: 5;
}

.card-toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.card-toolbar-btn {
    flex-shrink: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 8px 10px;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    user-select: none;
}

.card-toolbar-btn:hover:not(:disabled) {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: rgba(59, 130, 246, 0.25);
}

.card-toolbar-btn:disabled,
.card-toolbar-btn.is-disabled {
    opacity: 0.35;
    cursor: default;
}

.card-toolbar-center {
    position: relative;
    display: flex;
    justify-content: center;
    min-width: 72px;
}

.card-num-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    padding: 8px 16px;
    cursor: pointer;
    font: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.card-num-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.22);
    border-color: var(--accent);
}

.card-num-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.card-num-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.card-jump-pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 20;
}

.card-jump-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.card-jump-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.card-jump-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
}

.card-jump-hint {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.card-area {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-height: 220px;
    margin-bottom: 20px;
    padding: 36px 28px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s, background 0.2s;
    outline: none;
}

.card-area:hover,
.card-area:focus-visible {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.card-area:active {
    transform: scale(0.995);
}

.card-area.is-empty {
    cursor: default;
    border-style: dashed;
}

.card-area.is-empty:hover {
    border-color: var(--border);
    background: var(--surface);
    transform: none;
}

.btn-copy {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-copy:hover,
.btn-copy.is-copied {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.card-content {
    text-align: left;
}

.sentence-tr,
.sentence-de {
    font-size: clamp(1.25rem, 4vw, 1.65rem);
    font-weight: 600;
    margin: 0 0 16px;
    line-height: 1.45;
    white-space: pre-line;
    text-align: left;
}

.sentence-tr {
    color: var(--tr-color);
}

.sentence-de {
    font-size: clamp(1.1rem, 3.5vw, 1.4rem);
    color: var(--de-color);
    margin-bottom: 0;
    animation: fadeIn 0.25s ease;
}

.sentence-de.is-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 1rem;
    font-weight: 400;
}

.selectable {
    user-select: text;
    cursor: text;
}

.hint,
.footer-hint,
.empty-msg {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

.footer-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
}

.action-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.move-dropdown {
    position: relative;
}

.btn-move {
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-move:hover,
.btn-move.is-open {
    border-color: var(--text);
    color: var(--text);
    background: var(--surface-hover);
}

.btn-move:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.move-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    min-width: 140px;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 20;
}

.move-menu-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
}

.move-menu-item:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.btn-edit,
.btn-learned {
    padding: 10px 28px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-learned {
    background: transparent;
    border: 1px solid var(--success);
    color: var(--success);
}

.btn-learned:hover {
    background: var(--success);
    color: var(--success-text);
}

.btn-edit {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
}

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

.btn-new {
    padding: 10px 28px;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-new:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.modal-box:has(.edit-form) {
    max-width: 800px;
    width: calc(100% - 32px);
}

.modal-tools {
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    z-index: 2;
    min-width: 88px;
}

.btn-tool {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-tool:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-tool-translate {
    color: var(--accent);
    border-color: rgba(59, 130, 246, 0.35);
}

.btn-tool-unlearn {
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.35);
    font-size: 0.7rem;
    white-space: normal;
    line-height: 1.25;
    text-align: center;
}

.btn-tool:disabled {
    opacity: 0.6;
    cursor: wait;
}

.modal-box .modal-title {
    padding-right: 110px;
}

.modal-tools {
    min-width: 108px;
}

.sentence-table-row {
    cursor: pointer;
}

.sentence-table-row:hover td {
    background: var(--accent-soft);
}

.modal-title {
    margin: 0 0 20px;
    font-size: 1.25rem;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.edit-textarea {
    width: 100%;
    min-height: 160px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
}

.edit-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
}

.modal-actions-split {
    justify-content: space-between;
    align-items: center;
}

.modal-actions-end {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.admin-page h1 {
    margin: 0 0 8px;
    font-size: 1.6rem;
}

.admin-desc {
    color: var(--text-muted);
    margin: 0 0 20px;
}

.sql-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.sql-export-hint {
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.settings-title {
    margin: 0 0 8px;
    font-size: 1.35rem;
}

.settings-subtitle {
    margin: 0 0 8px;
    font-size: 1rem;
    color: var(--accent);
}

.settings-form {
    margin-bottom: 28px;
}

.settings-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.settings-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.password-show-btn {
    align-self: flex-start;
    margin-top: -4px;
    padding: 0;
    border: none;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.password-show-btn:hover {
    color: var(--text);
}

.password-show-btn:focus-visible {
    outline: none;
    border-radius: 4px;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.admin-center-wide {
    align-items: stretch;
}

.admin-panel-wide {
    max-width: 900px;
}

.users-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.users-page-head .settings-title {
    margin: 0;
}

.users-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    table-layout: fixed;
}

.users-table th,
.users-table td {
    border-bottom: 1px solid var(--border);
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    line-height: 1.4;
}

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

.users-table tbody tr:last-child td {
    border-bottom: none;
}

.users-table tbody tr:hover td {
    background: var(--accent-soft);
}

.users-table .col-id {
    width: 56px;
    text-align: center;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.users-table .col-nickname {
    width: 16%;
    font-weight: 600;
}

.users-table .col-email {
    width: auto;
    word-break: break-word;
}

.users-table .col-admin {
    width: 80px;
    text-align: center;
}

.users-table .col-actions {
    width: 280px;
}

.users-table-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 28px 16px !important;
}

.users-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(128, 128, 128, 0.12);
    color: var(--text-muted);
}

.users-badge.is-admin {
    background: var(--accent-soft);
    color: var(--accent);
}

.users-page .settings-form {
    margin-bottom: 0;
}

.modal-box .modal-title {
    padding-right: 0;
}

.inline-form {
    margin: 0;
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.users-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.form-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.btn-danger {
    color: #c0392b;
    border-color: #e8b4b0;
}

.btn-danger:hover {
    background: #fdecea;
    border-color: #c0392b;
}

.cell-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.import-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.form-check input {
    accent-color: var(--accent);
}

.admin-file-input {
    width: 100%;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.admin-select {
    max-width: 280px;
    border-radius: 10px;
}

.form-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.import-textarea {
    width: 100%;
    min-height: 360px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
}

.import-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary {
    align-self: flex-start;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #86efac;
}

[data-theme="light"] .alert-success {
    color: #15803d;
}

.alert-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

[data-theme="light"] .alert-error {
    color: #b91c1c;
}

.alert-info {
    background: var(--accent-soft);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #93c5fd;
}

[data-theme="light"] .alert-info {
    color: #1d4ed8;
}

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

@media (max-width: 900px) {
    .home-layout,
    .admin-layout {
        flex-direction: column;
    }

    .home-aside,
    .admin-aside {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
        margin-right: 0;
        padding: 16px 20px 20px;
    }

    .home-main {
        padding: 28px 20px 16px;
    }

    .admin-center {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .nav-slot {
        width: 56px;
    }

    .nav-slot-home {
        width: 56px;
    }

    .card-area {
        padding: 28px 18px;
        min-height: 180px;
    }

    .action-wrap {
        flex-direction: column;
    }

    .move-dropdown {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .move-menu {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

/* Kart yorumları — ana kart */
.card-comments-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.btn-comments-filter {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-comments-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-comments-filter.is-active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}

.btn-comments-open {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-comments-open:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-comments-open:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-comments-icon {
    font-size: 1rem;
    line-height: 1;
}

.btn-comments-label {
    font-weight: 500;
}

.btn-comments-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-comments-badge[hidden] {
    display: none;
}

body.comments-modal-open {
    overflow: hidden;
}

.modal-box-comments {
    max-width: 720px;
    max-height: min(94vh, 860px);
    display: flex;
    flex-direction: column;
    padding-bottom: 16px;
}

.modal-box-comments button {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
}

.modal-box-comments .modal-title {
    padding-right: 0;
    margin: 0;
}

.comments-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.comments-card-preview {
    flex-shrink: 0;
    margin-bottom: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    text-align: left;
}

.comments-card-preview-compact .sentence-tr {
    font-size: 0.95rem;
    margin: 0;
    white-space: pre-line;
}

.comments-card-preview-compact .sentence-de {
    font-size: 0.88rem;
    margin: 8px 0 0;
    color: var(--text-muted);
    white-space: pre-line;
}

.comment-compose {
    margin-bottom: 12px;
}

.comment-compose-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
    resize: vertical;
    min-height: 3rem;
}

.comment-compose-input:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-compose-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.comments-thread {
    flex: 1;
    min-height: 200px;
    max-height: 58vh;
    overflow-y: auto;
    padding-right: 4px;
}

.comments-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 24px 12px;
}

.comment-thread-node {
    position: relative;
}

.comment-thread-node[data-depth="0"] {
    margin-bottom: 4px;
}

.comment-children {
    margin-left: 8px;
}

.comment-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 0 0 12px;
}

.comment-item.is-mine .comment-author {
    color: var(--accent);
}

.comment-item.is-mine .comment-main {
    border-color: rgba(59, 130, 246, 0.35);
}

.comment-thread-rail {
    position: relative;
    flex-shrink: 0;
    width: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.comment-collapse-btn,
.comment-collapse-spacer {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    z-index: 1;
}

.comment-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.comment-collapse-spacer {
    display: block;
}

.comment-thread-line {
    flex: 1;
    width: 2px;
    min-height: 12px;
    margin-top: 4px;
    background: var(--accent);
    opacity: 0.35;
    border-radius: 1px;
}

.comment-main {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.comment-footer {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.reddit-vote-pill {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.reddit-vote-pill-readonly {
    padding: 4px 14px;
}

.reddit-vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    font-size: 0.7rem;
    line-height: 1;
    user-select: none;
    transition: background 0.12s, color 0.12s;
}

.reddit-vote-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.reddit-vote-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.reddit-vote-up.is-active {
    color: #ff4500;
}

.reddit-vote-down.is-active {
    color: #7193ff;
}

.reddit-vote-score {
    min-width: 1.1rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.comment-reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    transition: background 0.12s, color 0.12s;
}

.reply-glyph {
    font-size: 0.85rem;
    line-height: 1;
}

.comment-reply-btn:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.comment-reply-box {
    margin-top: 10px;
}

.comment-reply-textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.45;
    resize: vertical;
    min-height: 5rem;
}

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

.comment-reply-box-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.btn-reply-cancel {
    padding: 6px 14px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}

.btn-reply-cancel:hover {
    background: var(--surface-hover);
}

.btn-reply-submit,
.btn-comment-submit {
    padding: 6px 16px;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-reply-submit:hover,
.btn-comment-submit:hover {
    filter: brightness(1.08);
}

.comment-score {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    min-height: 1.1rem;
}

.comment-body-col {
    flex: 1;
    min-width: 0;
}

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.comment-author {
    font-weight: 700;
    color: var(--text);
}

.comment-sep {
    opacity: 0.6;
}

.comment-text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.comment-link {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--accent);
}

.comments-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comments-link-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
}

.comments-link-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.comments-form-error {
    margin: 0;
    color: var(--danger);
    font-size: 0.85rem;
}

/* Site footer – Feedback */
.site-footer {
    display: flex;
    justify-content: center;
    padding: 20px 16px 28px;
    margin-top: auto;
}

.site-footer-feedback {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.site-footer-feedback:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.modal-box-feedback {
    max-width: 480px;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feedback-success {
    margin: 0;
    color: var(--success, #2e9d5a);
    font-size: 0.9rem;
}

/* Admin feedback groups */
.feedback-admin-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.feedback-status-group {
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    background: var(--surface);
    overflow: hidden;
}

.feedback-status-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    user-select: none;
}

.feedback-status-summary::-webkit-details-marker {
    display: none;
}

.feedback-status-summary::before {
    content: '▸';
    margin-right: 8px;
    transition: transform 0.15s;
    color: var(--text-muted);
}

.feedback-status-group[open] .feedback-status-summary::before {
    transform: rotate(90deg);
}

.feedback-status-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
}

.feedback-status-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
}

.feedback-status-empty {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.feedback-admin-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feedback-admin-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}

.feedback-admin-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.feedback-admin-page {
    display: block;
    font-size: 0.82rem;
    color: var(--accent);
    word-break: break-all;
    margin-bottom: 8px;
}

.feedback-admin-text {
    margin: 0 0 10px;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.feedback-status-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.feedback-status-form .form-label {
    width: 100%;
    margin-bottom: -4px;
}

.todo-compose-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.todos-page.admin-panel-wide {
    max-width: 1100px;
}

.todos-page .users-page-head {
    margin-bottom: 4px;
}

.todo-compose-input {
    min-height: 88px;
}

.todo-item-actions {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.todo-item-actions-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.todos-page .todo-item-actions {
    overflow-x: auto;
}

.todo-status-form,
.todo-takeover-form,
.todo-assign-form,
.todo-delete-form {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    margin: 0;
}

.todo-delete-form {
    flex-shrink: 0;
    margin-left: auto;
}

.todo-status-form .form-label {
    width: 100%;
    margin-bottom: -4px;
}

.todo-assign-form {
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.todo-assign-form .form-label {
    width: auto;
    white-space: nowrap;
    margin-bottom: 0;
}

.todo-assign-form .comments-sort-select {
    max-width: 200px;
}

.btn-danger-text {
    color: #c0392b;
}

[data-theme="dark"] .btn-danger-text {
    color: #ff6b6b;
}

/* Exp/Imp page */
.exp-imp-page {
    max-width: 900px;
}

.exp-imp-plan-block {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.exp-imp-plan-block:first-of-type {
    margin-top: 12px;
    padding-top: 0;
    border-top: none;
}

.exp-imp-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.exp-imp-section:first-of-type {
    margin-top: 16px;
    padding-top: 0;
    border-top: none;
}

.exp-imp-hint {
    margin-top: 12px;
    font-size: 0.88rem;
}

.exp-imp-table-wrap {
    overflow-x: auto;
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
}

.exp-imp-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.exp-imp-data-table th,
.exp-imp-data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.exp-imp-data-table th {
    background: var(--bg);
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.exp-imp-data-table tr:last-child td {
    border-bottom: none;
}

.exp-imp-data-table code {
    font-size: 0.82rem;
}

.exp-imp-workflows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.exp-imp-workflow-card {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    background: var(--bg);
}

.exp-imp-workflow-title {
    margin: 0 0 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
}

.exp-imp-workflow-steps {
    margin: 0;
    padding-left: 1.2rem;
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.exp-imp-workflow-steps li + li {
    margin-top: 6px;
}

.exp-imp-admin-sql {
    padding: 16px;
    border-radius: var(--radius, 10px);
    background: var(--accent-soft);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.exp-imp-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.exp-imp-list-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius, 10px);
    background: var(--surface);
}

.exp-imp-subheading {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
}

.exp-imp-heading {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 700;
}

.exp-imp-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.exp-imp-list-picker {
    margin: 16px 0 8px;
    max-width: 360px;
}

.exp-imp-list-select {
    width: 100%;
    max-width: 360px;
}

.modal-box-import {
    max-width: 640px;
    width: calc(100% - 32px);
}

.modal-box-import-wide {
    max-width: 720px;
}

.import-textarea-modal {
    min-height: 280px;
}

body.import-modal-open {
    overflow: hidden;
}
