@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700;800&display=swap');

:root {
    --bg-primary: #07090e;
    --bg-secondary: #0f131a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(0, 242, 254, 0.5);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-cyan: #00f2fe;
    --accent-violet: #7f5af0;
    --accent-emerald: #2cb67d;
    --accent-rose: #ff7597;
    
    --glass-bg: rgba(15, 22, 36, 0.6);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(127, 90, 240, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 242, 254, 0.08) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header Styles */
header {
    background: rgba(7, 9, 14, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: rgba(0, 242, 254, 0.1);
    -webkit-text-fill-color: var(--accent-cyan);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(0, 242, 254, 0.2);
}

/* Main Container */
main {
    flex: 1;
    max-width: 1300px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.75rem;
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

input[type="text"],
select,
textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s ease-in-out;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
}

textarea {
    resize: vertical;
    min-height: 150px;
}

.file-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all 0.2s ease;
}

.file-dropzone:hover, .file-dropzone.dragover {
    border-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.02);
}

.file-dropzone input[type="file"] {
    display: none;
}

.file-dropzone i {
    font-size: 2.5rem;
    color: var(--accent-cyan);
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-violet) 100%);
    color: #07090e;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-accent {
    background: rgba(127, 90, 240, 0.2);
    color: #bfaaff;
    border: 1px solid rgba(127, 90, 240, 0.4);
}

.btn-accent:hover {
    background: rgba(127, 90, 240, 0.3);
}

.btn-danger {
    background: rgba(255, 117, 151, 0.15);
    color: #ff8fae;
    border: 1px solid rgba(255, 117, 151, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 117, 151, 0.25);
}

/* Dashboard List */
.chapter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.chapter-card {
    background: rgba(15, 22, 36, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-violet);
    opacity: 0.6;
}

.chapter-card:hover {
    transform: translateY(-4px);
    border-color: rgba(127, 90, 240, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.chapter-title {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.chapter-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.lang-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.chapter-body {
    margin-bottom: 1.5rem;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-violet) 0%, var(--accent-cyan) 100%);
    border-radius: 10px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chapter-actions {
    display: flex;
    gap: 0.75rem;
}

/* Workspace Panels */
.workspace-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    min-height: 480px;
}

@media (max-width: 900px) {
    .workspace-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.editor-pane {
    display: flex;
    flex-direction: column;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.pane-content {
    flex: 1;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.7;
    position: relative;
}

.original-pane {
    background: rgba(255, 255, 255, 0.015);
    user-select: text;
}

.translation-textarea {
    width: 100%;
    height: 100%;
    min-height: 320px;
    background: rgba(15, 22, 36, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
    padding: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.7;
    font-family: inherit;
    resize: none;
    transition: all 0.3s ease;
}

.translation-textarea:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.1);
    background: rgba(15, 22, 36, 0.5);
}

/* Status Indicators */
.status-pill {
    padding: 0.25rem 0.6rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.status-pending {
    background: rgba(255, 240, 0, 0.1);
    color: #ffd60a;
    border: 1px solid rgba(255, 240, 0, 0.25);
}

.status-translated {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.25);
}

.status-reviewed {
    background: rgba(44, 182, 125, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(44, 182, 125, 0.25);
}

/* Navigation Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-title-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-controls {
    display: flex;
    gap: 0.75rem;
}

/* Pulse Loading State */
.translating-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 320px;
    color: var(--text-secondary);
    text-align: center;
}

.pulse-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-cyan);
    box-shadow: 0 0 20px var(--accent-cyan);
    margin-bottom: 1.5rem;
    animation: pulse 1.8s infinite ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.4;
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0.7);
    }
    70% {
        transform: scale(1.1);
        opacity: 0.9;
        box-shadow: 0 0 0 20px rgba(0, 242, 254, 0);
    }
    100% {
        transform: scale(0.9);
        opacity: 0.4;
        box-shadow: 0 0 0 0 rgba(0, 242, 254, 0);
    }
}

/* Keyboard Help Badge */
.shortcut-help {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.key {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Views Management */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Empty Dashboard State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

/* DeepL Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 5, 8, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease-out;
}

/* Modal Content Box */
.modal-content {
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    padding: 2rem;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-header h3 {
    margin-bottom: 0;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-cyan);
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.75rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: var(--accent-rose);
}

.modal-body {
    margin-bottom: 1.5rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom premium scrollbar for modal body */
.modal-body::-webkit-scrollbar {
    width: 6px;
}
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
body.light-theme .modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

.translation-comparison {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.comparison-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.block-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comparison-text {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    min-height: 60px;
}

.highlighted-translation {
    border-color: rgba(0, 242, 254, 0.2);
    background: rgba(0, 242, 254, 0.02);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

/* Light Theme Overrides */
body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-focus: var(--accent-violet);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-cyan: #0284c7;
    --accent-violet: #4f46e5;
    --accent-emerald: #16a34a;
    --accent-rose: #e11d48;
    
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(0, 0, 0, 0.06);
    --glass-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.06);
}

body.light-theme {
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.04) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(2, 132, 199, 0.04) 0px, transparent 50%);
}

body.light-theme header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-theme .logo span {
    background: rgba(2, 132, 199, 0.08);
    -webkit-text-fill-color: var(--accent-cyan);
    border: 1px solid rgba(2, 132, 199, 0.15);
}

body.light-theme .translation-textarea {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-primary);
}

body.light-theme .original-pane {
    background: rgba(0, 0, 0, 0.01);
}

body.light-theme .comparison-text {
    background: rgba(0, 0, 0, 0.02);
}

body.light-theme .highlighted-translation {
    border-color: rgba(2, 132, 199, 0.2);
    background: rgba(2, 132, 199, 0.02);
}

body.light-theme .shortcut-help span.key {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

body.light-theme .progress-bar-container {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .modal-close-btn:hover {
    color: var(--accent-rose);
}

body.light-theme .chapter-card {
    background: rgba(255, 255, 255, 0.4);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 380px;
    width: 90%;
    pointer-events: none;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition: transform 0.3s, opacity 0.3s;
}

.toast-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.toast-error {
    border-left: 4px solid var(--accent-rose);
}
.toast-error .toast-icon {
    color: var(--accent-rose);
}

.toast-success {
    border-left: 4px solid var(--accent-emerald);
}
.toast-success .toast-icon {
    color: var(--accent-emerald);
}

.toast-warning {
    border-left: 4px solid var(--accent-cyan);
}
.toast-warning .toast-icon {
    color: var(--accent-cyan);
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}


/* Book organization and viewport-sized desktop workspace. */
.dashboard-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.dashboard-controls label { min-width: 180px; margin: 0; }
.chapter-selection { display: flex; align-items: center; gap: .5rem; }
.chapter-actions { flex-wrap: wrap; }
.chapter-title { overflow-wrap: anywhere; }
.translation-editor { position: relative; flex: 1; min-height: 0; }
.workspace-controls { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-color); }
.modal-content { max-height: 90dvh; display: flex; flex-direction: column; }
.modal-body { min-height: 0; overflow: auto; }
@media (min-width: 901px) {
    body.reviewing { height: 100dvh; min-height: 0; overflow: hidden; }
    body.reviewing header { flex-shrink: 0; padding: .75rem 1.5rem; }
    body.reviewing main { min-height: 0; display: flex; flex-direction: column; max-width: none; margin: 0; padding: 1rem 1.5rem; }
    #review-view.active { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .5rem; }
    #review-view > .glass-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0 !important; padding: 1rem 1.25rem !important; }
    #review-view .toolbar { flex-shrink: 0; gap: .75rem; margin-bottom: .75rem; }
    #review-view .toolbar h2 { max-width: 35vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    #review-view .progress-bar-container { flex-shrink: 0; margin-bottom: .75rem !important; }
    .workspace-layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
    .editor-pane { min-height: 0; min-width: 0; }
    .pane-header { min-height: 32px; gap: .5rem; flex-wrap: wrap; flex-shrink: 0; }
    .pane-content { min-height: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
    .translation-textarea { min-height: 0; display: block; overflow: auto; }
    .workspace-controls { flex-shrink: 0; margin-top: .75rem; padding-top: .75rem; }
    #review-view .shortcut-help { flex-shrink: 0; margin: 0; padding: 0; flex-wrap: wrap; gap: .5rem 1rem; }
    .translating-placeholder { min-height: 0; overflow: auto; padding: 1rem; }
    #review-view .toolbar { flex-wrap: wrap; padding-bottom: .75rem; }
    .toolbar-title-section { min-width: 0; }
}
@media (max-width: 900px) {
    header { padding: .75rem; gap: .5rem; flex-wrap: wrap; }
    .header-actions { flex-wrap: wrap; }
    .translation-editor { min-height: 320px; }
    .workspace-controls { flex-wrap: wrap; }
}

[hidden] { display: none !important; }
input[type="password"] { width: 100%; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; padding: .75rem 1rem; color: var(--text-primary); font: inherit; }
select option { background: var(--bg-secondary); color: var(--text-primary); }
.auth-hidden > header, .auth-hidden > main { display: none; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
body:not(.auth-hidden) .login-screen { display: none; }
.account-panel { width: 100%; max-width: 560px; margin: 0 auto 1.5rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin: 1rem 0; flex-wrap: wrap; }
.app-dialog { margin: auto; width: min(520px, calc(100vw - 2rem)); max-height: 90dvh; overflow: auto; color: var(--text-primary); background: var(--bg-secondary); }
.app-dialog::backdrop { background: rgba(0,0,0,.65); backdrop-filter: blur(4px); }
.content-type { display: inline-block; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-cyan); margin-bottom: .75rem; }
.book-card { border-color: var(--accent-violet); }
.book-actions { margin-top: 1.5rem; }
.user-row { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
#users-list { margin-bottom: 2rem; }
#login-error { color: var(--accent-rose); }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
#signed-in-user { font-size: .8rem; color: var(--text-secondary); }
@media (min-width: 901px) and (max-width: 1250px) {
    header .btn { padding: .5rem .65rem; font-size: .75rem; }
    .logo { font-size: 1.25rem; }
    #signed-in-user { display: none; }
}

/* Account menu and optional review comments. */
button.logo { border: 0; -webkit-text-fill-color: var(--text-primary); background: none; color: var(--text-primary); cursor: pointer; font-family: inherit; padding: 0; }
.account-menu { position: relative; }
.account-menu summary { list-style: none; cursor: pointer; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu-items { position: absolute; right: 0; top: calc(100% + .5rem); z-index: 100; min-width: 160px; padding: .5rem; background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 8px 24px #0005; }
.account-menu-items .btn { display: flex; width: 100%; margin: .2rem 0; }
.export-options { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; }
.workspace-body { display: flex; gap: 1rem; flex: 1; min-height: 0; }
.workspace-body .workspace-layout { flex: 1; min-width: 0; }
.comments-panel { flex: 0 0 clamp(240px, 24vw, 340px); overflow: auto; min-height: 0; border: 1px solid var(--border-color); border-radius: 12px; padding: .75rem; }
.comment-hint, .comment-meta { font-size: .75rem; color: var(--text-secondary); }
.comment-meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.comment-card { border-top: 1px solid var(--border-color); padding: .75rem 0; overflow-wrap: anywhere; }
.comment-anchor { background: var(--bg-secondary); border: 1px solid var(--border-color); color: var(--text-primary); border-radius: 6px; padding: .5rem; text-align: left; font: inherit; font-size: .8rem; cursor: pointer; max-height: 100px; overflow: auto; width: 100%; }
.comment-body { white-space: pre-wrap; margin: .75rem 0; font-size: .85rem; }
.comment-status { font-size: .75rem; font-weight: 700; }
.comment-accepted { color: var(--accent-emerald); }
.comment-rejected { color: var(--accent-rose); }
.comment-decisions { display: flex; gap: .5rem; margin-top: .5rem; }
#comment-selection-preview { max-height: 140px; overflow: auto; white-space: pre-wrap; padding: .75rem; border-left: 3px solid var(--accent-cyan); margin: 1rem 0; }
#comment-body { min-height: 110px; }
#comment-error { color: var(--accent-rose); }
.workspace-controls { justify-content: flex-end; }
@media (max-width: 900px) {
    .workspace-body { flex-direction: column; }
    .comments-panel { flex: auto; max-height: 400px; }
}


/* Matching toolbars keep the original and translation editors aligned. */
.pane-header.pane-toolbar {
    height: 48px;
    min-height: 48px;
    flex-shrink: 0;
    flex-wrap: nowrap;
    gap: .5rem;
    padding: .35rem .5rem .35rem .75rem;
    margin-bottom: .75rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
}
.pane-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pane-tools { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.pane-tool-btn { width: 32px; height: 32px; padding: 0; justify-content: center; font-size: .85rem; border-radius: 8px; }
.pane-tool-btn:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }

button.logo { flex-shrink: 0; }
button.logo i { color: var(--accent-cyan); -webkit-text-fill-color: var(--accent-cyan); }
.comment-suggestion { border-left: 3px solid var(--accent-emerald); padding: .5rem; white-space: pre-wrap; font-size: .85rem; margin: .5rem 0; background: var(--bg-secondary); }
.comment-replies { margin-top: .75rem; padding-left: .75rem; border-left: 2px solid var(--border-color); }
.comment-reply { padding: .4rem 0; }
.comment-reply p { white-space: pre-wrap; font-size: .85rem; }
.comment-reply-form textarea { min-height: 65px; font-size: .85rem; padding: .5rem; }
.comment-reply-form .btn { margin-top: .5rem; }
