/* Ducky Case Workspace — Calming, Accessible Design System */
:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --bg-hover: #e2e8f0;
    
    --fg-primary: #0f172a;
    --fg-secondary: #475569;
    --fg-muted: #64748b;
    --fg-light: #94a3b8;

    --border-color: #e2e8f0;
    --border-focus: #3b82f6;

    --brand-primary: #0284c7;
    --brand-primary-hover: #0369a1;
    --brand-light: #e0f2fe;

    --accent-emerald: #059669;
    --accent-emerald-light: #ecfdf5;
    --accent-amber: #d97706;
    --accent-amber-light: #fffbeb;
    --accent-rose: #e11d48;
    --accent-rose-light: #fff1f2;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--fg-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

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

.app-logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.logo-emoji {
    font-size: 1.75rem;
    background: #fef08a;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.logo-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--fg-primary);
    letter-spacing: -0.01em;
}

.logo-subtitle {
    font-size: 0.75rem;
    color: var(--fg-muted);
    display: block;
}

.autosave-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-subtle);
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--fg-secondary);
    border: 1px solid var(--border-color);
}

.save-dot {
    width: 7px;
    height: 7px;
    background-color: var(--accent-emerald);
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.2s;
}

.save-dot.saving {
    background-color: var(--accent-amber);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* --- Navigation Tabs --- */
.nav-tabs-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
}

.tabs-container {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.85rem 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--fg-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    color: var(--fg-primary);
    background-color: var(--bg-subtle);
}

.tab-btn.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
    background: none;
}

/* --- Layout Container --- */
.app-main {
    max-width: 1360px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.content-grid-2 {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
}

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

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-header {
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--fg-primary);
}

.card-hint {
    font-size: 0.75rem;
    color: var(--fg-muted);
}

.subtitle {
    font-size: 0.82rem;
    color: var(--fg-muted);
    margin-top: 0.2rem;
}

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

/* --- Forms & Inputs --- */
.grid-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--fg-secondary);
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--fg-primary);
    font-size: 0.88rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

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

textarea {
    resize: vertical;
}

.full-textarea {
    font-family: inherit;
    line-height: 1.6;
    padding: 0.85rem;
}

.claims-checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--fg-secondary);
    cursor: pointer;
    background: var(--bg-subtle);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.checkbox-label input {
    cursor: pointer;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.btn-primary {
    background-color: var(--brand-primary);
    color: white;
}

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

.btn-secondary {
    background-color: var(--bg-subtle);
    border-color: var(--border-color);
    color: var(--fg-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
}

.btn-danger {
    background-color: var(--accent-rose);
    color: white;
}

.btn-danger:hover {
    background-color: #be123c;
}

.btn-danger-outline {
    background-color: transparent;
    border-color: #fca5a5;
    color: var(--accent-rose);
}

.btn-danger-outline:hover {
    background-color: var(--accent-rose-light);
}

.btn-ghost {
    background: transparent;
    color: var(--fg-muted);
}

.btn-ghost:hover {
    background-color: var(--bg-subtle);
    color: var(--fg-primary);
}

.btn-block {
    width: 100%;
}

/* --- Statutory Info Banner --- */
.statutory-banner {
    display: flex;
    gap: 0.85rem;
    background: var(--accent-amber-light);
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-top: 1rem;
    color: #92400e;
    font-size: 0.82rem;
    line-height: 1.5;
}

.info-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* --- Dropzone & Uploads --- */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    margin-bottom: 1.5rem;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--brand-primary);
    background-color: var(--brand-light);
}

.upload-icon {
    font-size: 2.2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.dropzone h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.dropzone p {
    font-size: 0.82rem;
    color: var(--fg-muted);
    max-width: 500px;
    margin: 0 auto 1.25rem;
}

.dropzone-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.progress-bar-container {
    background: #e2e8f0;
    border-radius: var(--radius-sm);
    height: 24px;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #0284c7, #38bdf8);
    animation: progressIndeterminate 1.5s infinite linear;
    transform-origin: 0% 50%;
}

@keyframes progressIndeterminate {
    0% { transform: translateX(0) scaleX(0); }
    40% { transform: translateX(0) scaleX(0.4); }
    100% { transform: translateX(100%) scaleX(0.5); }
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
}

/* --- Tables --- */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-card .card-header {
    padding: 1.25rem 1.5rem;
    margin: 0;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    text-align: left;
}

.data-table th {
    background-color: var(--bg-subtle);
    padding: 0.75rem 1rem;
    font-weight: 700;
    color: var(--fg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}

.data-table tr:hover {
    background-color: #f8fafc;
}

.exhibit-badge {
    display: inline-block;
    background: var(--brand-light);
    color: var(--brand-primary);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-family: 'JetBrains Mono', monospace;
}

.quote-box {
    font-style: italic;
    color: var(--fg-secondary);
    border-left: 2px solid #cbd5e1;
    padding-left: 0.5rem;
    margin-top: 0.35rem;
    font-size: 0.8rem;
}

.legal-tag {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-sm);
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    margin-top: 0.35rem;
}

/* --- Patterns List --- */
.patterns-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pattern-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.15rem;
    background: var(--bg-card);
    border-left: 4px solid var(--brand-primary);
}

.pattern-item.retaliation {
    border-left-color: var(--accent-rose);
    background-color: #fffafb;
}

.pattern-item.acas {
    border-left-color: var(--accent-amber);
    background-color: #fffdfa;
}

.pattern-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.pattern-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--fg-primary);
}

.pattern-desc {
    font-size: 0.85rem;
    color: var(--fg-secondary);
    margin-bottom: 0.5rem;
}

.pattern-recommendation {
    font-size: 0.8rem;
    background: rgba(0,0,0,0.03);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--fg-primary);
}

/* --- Chat Interface --- */
.chat-layout {
    max-width: 900px;
    margin: 0 auto;
}

.chat-stream {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 520px;
    min-height: 380px;
    overflow-y: auto;
    padding: 1rem;
    background: #fbfcfd;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.chat-msg {
    display: flex;
    gap: 0.85rem;
    max-width: 88%;
}

.chat-msg.user-msg {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-msg.assistant-msg {
    align-self: flex-start;
}

.msg-avatar {
    width: 34px;
    height: 34px;
    background: var(--bg-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.user-msg .msg-avatar {
    background: #e2e8f0;
}

.msg-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: 0.87rem;
    line-height: 1.6;
    color: var(--fg-primary);
    box-shadow: var(--shadow-sm);
}

.user-msg .msg-content {
    background: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

.msg-content ul, .msg-content ol {
    margin-left: 1.35rem;
    margin-top: 0.4rem;
    margin-bottom: 0.6rem;
    padding-left: 0.2rem;
}

.msg-content li {
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

.msg-content li:last-child {
    margin-bottom: 0;
}

.msg-content p {
    margin-bottom: 0.5rem;
}

.msg-content p:last-child {
    margin-bottom: 0;
}

.msg-content a {
    color: var(--brand-primary);
    text-decoration: underline;
    font-weight: 600;
}

.msg-content a:hover {
    color: var(--brand-primary-hover);
}

.msg-content blockquote {
    background: #f8fafc;
    border-left: 3px solid var(--brand-primary);
    padding: 0.65rem 0.85rem;
    margin: 0.6rem 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.85rem;
    color: var(--fg-primary);
}

.legal-term {
    position: relative;
    border-bottom: 1.5px dotted var(--brand-primary);
    cursor: help;
    font-weight: 600;
    color: #0369a1;
    text-decoration: none;
    padding: 0 2px;
    border-radius: 2px;
    display: inline-block;
}

.legal-term:hover {
    background-color: #e0f2fe;
}

.legal-term:hover::after,
.legal-term:focus::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.4;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    z-index: 100;
    pointer-events: none;
    text-align: left;
}

.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.prompt-chip {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--fg-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.prompt-chip:hover {
    background: var(--brand-light);
    color: var(--brand-primary);
    border-color: #bae6fd;
}

.chat-input-bar {
    display: flex;
    gap: 0.5rem;
}

.chat-input-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1.5rem;
}

.modal-dialog {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.modal-dialog-sm {
    max-width: 480px;
}

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

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--fg-muted);
}

.btn-close:hover {
    color: var(--fg-primary);
}

.modal-body {
    padding: 1.5rem;
}

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

/* --- Badges --- */
.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    background: var(--bg-subtle);
    color: var(--fg-secondary);
}

.badge-success {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
}

/* --- Login View --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 1.5rem;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    padding: 2.25rem 2rem;
    max-width: 380px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
}

.login-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--brand-light);
    color: var(--brand-primary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    margin-bottom: 0.75rem;
}

.login-card h1 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--fg-primary);
    letter-spacing: -0.01em;
}

.login-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    text-align: left;
    margin: 0;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-input-wrap input {
    width: 100%;
    padding: 0.65rem 2.75rem 0.65rem 0.85rem;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
}

.btn-toggle-pwd {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--fg-muted);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: color 0.15s ease;
}

.btn-toggle-pwd:hover {
    color: var(--fg-primary);
}

.btn-block {
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.92rem;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* --- Easter Egg Styling --- */
.duck-easter-egg {
    display: inline-block;
    cursor: pointer;
    user-select: none;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.duck-easter-egg:hover {
    transform: scale(1.2) rotate(-8deg);
}

.duck-easter-egg.wiggling {
    animation: duckWiggle 0.6s ease-in-out;
}

@keyframes duckWiggle {
    0%, 100% { transform: scale(1.2) rotate(0deg); }
    25% { transform: scale(1.25) rotate(-14deg); }
    50% { transform: scale(1.25) rotate(14deg); }
    75% { transform: scale(1.2) rotate(-8deg); }
}

.duck-egg-pop {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fef08a;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
    border: 1px solid rgba(254, 240, 138, 0.3);
    animation: eggPopIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.duck-egg-pop::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent #0f172a transparent;
}

@keyframes eggPopIn {
    0% { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.85); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

@keyframes eggPopOut {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-4px) scale(0.9); }
}

.alert-box {
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    margin-bottom: 1rem;
    text-align: left;
}

.error-alert {
    background: var(--accent-rose-light);
    color: var(--accent-rose);
    border: 1px solid #fecdd3;
}

/* --- Document Preview Modal --- */
.modal-dialog-lg {
    max-width: 980px;
    width: 95%;
}

.preview-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.5rem;
}

@media (max-width: 840px) {
    .preview-grid {
        grid-template-columns: 1fr;
    }
}

.preview-media-pane {
    background: #0f172a;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    max-height: 580px;
    border: 1px solid var(--border-color);
}

.preview-media-pane img {
    max-width: 100%;
    max-height: 580px;
    object-fit: contain;
}

.preview-media-pane iframe {
    width: 100%;
    height: 580px;
    border: none;
    background: white;
}

.preview-media-fallback {
    color: #94a3b8;
    text-align: center;
    padding: 2rem;
    font-size: 0.88rem;
}

.preview-text-pane {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.preview-meta-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.preview-meta-table td {
    padding: 0.35rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.preview-meta-table td:first-child {
    font-weight: 600;
    color: var(--fg-muted);
    width: 110px;
}

.preview-raw-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    max-height: 340px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--fg-primary);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover strong {
    color: var(--brand-primary);
    text-decoration: underline;
}

.exhibit-badge.clickable-badge {
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
}

.exhibit-badge.clickable-badge:hover {
    transform: translateY(-1px);
    background-color: #bae6fd;
}

