/* Helion Energie brand: #8ECCE4 (primary), #7DBDD5 (hover), #313131 (text), #e7f3f8 (light bg) */

/* Base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f5f7f9; color: #313131; }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.app-content { flex: 1; overflow-y: auto; padding: 1.5rem; max-width: 100%; }

/* Sidebar */
.sidebar { width: 220px; background: #1e293b; color: #cbd5e1; display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-logo { padding: 16px 20px; border-bottom: 1px solid #334155; }
.sidebar-brand { color: #8ECCE4; font-weight: 700; font-size: 1.15rem; display: block; }
.sidebar-subtitle { color: #64748b; font-size: 0.7rem; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-section-label { padding: 4px 20px; font-size: 0.65rem; text-transform: uppercase; color: #64748b; letter-spacing: 0.5px; margin-top: 16px; margin-bottom: 4px; }
.sidebar-section-label:first-child { margin-top: 0; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: #94a3b8; text-decoration: none; font-size: 0.85rem; transition: background 0.15s, color 0.15s; border-left: 3px solid transparent; }
.sidebar-item:hover { background: #334155; color: #e2e8f0; }
.sidebar-item.active { background: #334155; color: #8ECCE4; border-left-color: #8ECCE4; }
.sidebar-icon { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-badge { background: #8ECCE4; color: #1e293b; font-size: 0.65rem; padding: 1px 6px; border-radius: 8px; margin-left: auto; font-weight: 600; }
.sidebar-badge:empty { display: none; }
.sidebar-footer { padding: 12px 20px; border-top: 1px solid #334155; display: flex; align-items: center; gap: 10px; }
.sidebar-avatar { width: 32px; height: 32px; background: #475569; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #8ECCE4; font-weight: 600; font-size: 0.8rem; flex-shrink: 0; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.8rem; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.65rem; color: #64748b; }
.sidebar-logout { color: #64748b; text-decoration: none; font-size: 1rem; padding: 4px; }
.sidebar-logout:hover { color: #f87171; }

/* Mobile sidebar toggle */
.sidebar-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 100; background: #1e293b; color: #8ECCE4; border: none; font-size: 1.3rem; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
@media (max-width: 768px) {
    .sidebar { position: fixed; left: -220px; z-index: 99; transition: left 0.25s ease; }
    .sidebar.open { left: 0; }
    .sidebar-toggle { display: block; }
    .app-content { padding-top: 3rem; }
}

/* Login page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #f5f7f9; }
.login-card { background: white; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); padding: 2.5rem; width: 100%; max-width: 380px; }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-brand { color: #8ECCE4; font-weight: 700; font-size: 1.75rem; display: block; }
.login-subtitle { color: #64748b; font-size: 0.85rem; }
.login-error { background: #fef2f2; color: #dc2626; padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.85rem; }
.login-field { margin-bottom: 1rem; }
.login-field label { display: block; font-size: 0.85rem; color: #64748b; margin-bottom: 0.3rem; }
.login-field input { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; }
.login-field input:focus { outline: none; border-color: #8ECCE4; box-shadow: 0 0 0 3px rgba(142, 204, 228, 0.2); }
.login-button { width: 100%; padding: 0.7rem; background: #8ECCE4; color: white; border: none; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; }
.login-button:hover { background: #7DBDD5; }

/* Content header (replaces old header) */
.content-header { display: flex; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.content-header h1 { font-size: 1.25rem; font-weight: 600; }
.content-header .filters { border: none; padding: 0; margin-left: auto; }

/* Presence badges (thread list + detail) — soft orange for "reading",
   stronger soft red for "drafting" so the escalation is obvious even in
   peripheral vision. */
.presence-badge { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem; border-radius: 10px; font-size: 0.7rem; background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; white-space: nowrap; }
.presence-badge--drafting { background: #fecaca; color: #991b1b; border-color: #f87171; }

.presence-banner { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.9rem; margin: 0.5rem 0 0.75rem; border-radius: 8px; background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; font-size: 0.9rem; font-weight: 500; box-shadow: 0 1px 2px rgba(154, 52, 18, 0.08); }
.presence-banner--drafting { background: #fecaca; color: #991b1b; border-color: #f87171; box-shadow: 0 1px 2px rgba(153, 27, 27, 0.12); }
.presence-banner-hidden { display: none; }

.draft-presence-note { display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.5rem; border-radius: 8px; background: #fecaca; color: #991b1b; border: 1px solid #f87171; font-size: 0.75rem; font-weight: 500; }

/* Thread-list counter bar */
.thread-counter-bar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.85rem; color: #666; }
.thread-counter strong { color: #313131; font-weight: 600; margin-right: 0.15rem; }
.thread-counter-sep { color: #ccc; }
.thread-counter-bar select { font-size: 0.8rem; padding: 0.1rem 0.3rem; border: 1px solid #ddd; border-radius: 6px; margin-left: 0.5rem; background: white; color: #666; }

/* Alert */
.alert { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: 0.85rem; }
.alert-error, .alert-danger { background: #fef2f2; color: #dc2626; }
.alert-success { background: #f0fdf4; color: #16a34a; }
.alert-warning { background: #fffbeb; color: #d97706; }

/* Thread list */
.thread-list { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.thread-row { display: grid; grid-template-columns: 80px 100px 1fr 200px 110px 36px; gap: 0.5rem; padding: 0.75rem 1rem; border-bottom: 1px solid #eee; align-items: center; text-decoration: none; color: inherit; font-size: 0.9rem; transition: background 0.2s ease; }
.thread-row:hover { background: #e7f3f8; }
.thread-row:last-child { border-bottom: none; }
.thread-header-row { font-size: 0.75rem; font-weight: 600; color: #999; text-transform: uppercase; letter-spacing: 0.03em; }
.thread-header-row:hover { background: transparent; }
.sort-header { color: #999; text-decoration: none; cursor: pointer; transition: color 0.2s ease; }
.sort-header:hover { color: #313131; }
.sort-header.sort-active { color: #313131; }

/* Status badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.badge-nieuw { background: #8ECCE4; color: white; }
.badge-orientatie { background: #e7f3f8; color: #2a7d9c; border: 1px solid #88c1dc; }
.badge-offerte { background: #fff3cd; color: #856404; }
.badge-besteld { background: #d4edda; color: #155724; }
.badge-afgewezen { background: #e2e3e5; color: #383d41; }
.badge-opvolging { background: #fed7aa; color: #9a3412; border: 1px solid #fdba74; }

/* Wacht op & inline dropdowns */
.wacht-op { font-size: 0.85rem; }
.wacht-op--helion { color: #313131; font-weight: 600; }
.wacht-op--client { color: #64748b; }
.thread-select { font-size: 0.75rem; padding: 0.15rem 0.3rem; border: 1px solid #ddd; border-radius: 4px; background: #fff; cursor: pointer; max-width: 100%; }
.thread-actions { text-align: center; }
.thread-menu-btn { background: none; border: none; cursor: pointer; color: #94a3b8; font-size: 1.1rem; padding: 2px 6px; border-radius: 4px; line-height: 1; }
.thread-menu-btn:hover { background: #e2e8f0; color: #313131; }
.thread-row-menu { position: fixed; z-index: 1000; background: white; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); padding: 4px 0; min-width: 200px; font-size: 0.85rem; }
.thread-row-menu-section { padding: 4px 12px; font-size: 0.7rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.thread-row-menu-item { padding: 6px 14px; cursor: pointer; color: #313131; display: flex; align-items: center; gap: 8px; }
.thread-row-menu-item:hover { background: #e7f3f8; }
.thread-row-menu-item.active { font-weight: 600; color: #8ECCE4; }
.thread-row-menu-item.danger { color: #dc3545; }
.thread-row-menu-item.danger:hover { background: #fef2f2; }
.thread-row-menu-sep { height: 1px; background: #e2e8f0; margin: 4px 0; }

/* Filters */
.filters { padding: 1rem; border-bottom: 1px solid #eee; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filters a { padding: 0.3rem 0.8rem; border-radius: 12px; text-decoration: none; font-size: 0.85rem; background: #eee; color: #313131; transition: all 0.3s ease; }
.filters a:hover { background: #e7f3f8; color: #2a7d9c; }
.filters a.active { background: #8ECCE4; color: white; }

/* Thread detail */
.thread-header { background: white; padding: 1rem 1.5rem; border-radius: 12px 12px 0 0; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-bottom: 1px; }
.thread-header h1 { font-size: 1.25rem; }

.messages { background: white; padding: 1rem 1.5rem; border-radius: 0 0 12px 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.message { margin: 0.75rem 0; padding: 0.75rem 1rem; border-radius: 12px; max-width: 80%; white-space: pre-line; line-height: 1.5; }
.message-in { background: #e7f3f8; margin-right: auto; border-left: 3px solid #8ECCE4; }
.message-out { background: #e8f5e9; margin-left: auto; border-left: 3px solid #5cb85c; }
.message-draft { border-style: dashed; border-color: #ff9800; background: #fff8e1; }
.message-meta { font-size: 0.7rem; color: #999; margin-bottom: 0.2rem; display: flex; align-items: center; }
/* !important needed because the Origineel/Verwerkt toggle sets inline
   `style="display: ..."` on .message-body divs; without !important the
   inline style wins and the collapse can't hide them. */
.message.collapsed .message-body { display: none !important; }
.message.collapsed { padding: 0.75rem 1rem; }
.message.collapsed .message-meta { margin-bottom: 0; }
.collapse-icon { display: inline-block; width: 18px; height: 18px; margin-right: 0.3rem; flex-shrink: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat center; }
.message.collapsed .collapse-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 6 15 12 9 18'/%3E%3C/svg%3E"); }
.message { cursor: pointer; }

/* Uniform expand/collapse chevron for all <details> elements */
summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 0.3rem; }
summary::-webkit-details-marker { display: none !important; }
summary::marker { display: none !important; content: ""; }
summary::before { content: ""; display: inline-block; width: 18px; height: 18px; flex-shrink: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 6 15 12 9 18'/%3E%3C/svg%3E") no-repeat center; }
details[open] > summary::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); }

/* YouTube video list */
.yt-row:hover { background: #e7f3f8; }

/* Back link */
a { color: #2a7d9c; }
a:hover { color: #7DBDD5; }

/* Params panel */
.params-panel { background: white; padding: 1rem 1.5rem; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); margin-top: 1rem; }
.params-panel h2 { font-size: 1rem; margin-bottom: 0.5rem; color: #313131; }
.params-panel table { width: 100%; font-size: 0.9rem; }
.params-panel td { padding: 0.25rem 0.5rem; border-bottom: 1px solid #f0f0f0; }
.params-panel td:first-child { font-weight: 600; width: 40%; }

/* Send button */
.btn-send { background: #8ECCE4; color: white; border: none; padding: 0.6rem 1.5rem; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background 0.3s ease; }
.btn-send:hover { background: #7DBDD5; }
.btn-send:disabled { background: #ccc; cursor: not-allowed; }

/* Revise button */
.btn-revise { background: #eee; color: #313131; border: 1px solid #ddd; padding: 0.6rem 1.5rem; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.btn-revise:hover { background: #e7f3f8; border-color: #88c1dc; color: #2a7d9c; }
.btn-revise:disabled { background: #f5f5f5; color: #999; cursor: not-allowed; }

/* Reset button — same size as btn-revise */
.btn-reset { background: white; color: #721c24; border: 1px solid #ddd; padding: 0.6rem 1.5rem; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.btn-reset:hover { background: #f8d7da; border-color: #f5c6cb; }

/* Delete button — destructive action */
.btn-delete { background: white; color: #721c24; border: 1px solid #ddd; padding: 0.4rem 1rem; border-radius: 12px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.btn-delete:hover { background: #dc3545; border-color: #dc3545; color: white; }

/* Delete icon button — inline in thread list */
.btn-delete-icon { background: none; border: none; cursor: pointer; color: #dc3545; padding: 0.3rem; transition: opacity 0.2s ease; line-height: 1; opacity: 0.6; }
.btn-delete-icon:hover { opacity: 1; }

/* Open questions */
.open-vragen { margin: 0.25rem 0 0 1.25rem; font-size: 0.9rem; }
.open-vragen li { padding: 0.25rem 0; border-bottom: 1px solid #f0f0f0; }
.open-vragen li:last-child { border-bottom: none; }

/* Revision history */
.revision-history { margin-bottom: 0.75rem; }
.revision-entry { padding: 0.4rem 0.6rem; margin-bottom: 0.25rem; background: #f8f9fa; border-radius: 6px; border-left: 3px solid #8ECCE4; }
.revision-meta { font-size: 0.7rem; color: #999; }
.revision-instruction { font-size: 0.85rem; color: #313131; }

/* Responsive */
@media (max-width: 768px) {
    .thread-row { grid-template-columns: 80px 1fr 36px; }
    .thread-row > :nth-child(n+3):not(:last-child) { display: none; }
    .message { max-width: 95%; }
}

/* Configurator form */
/* Configurator layout */
.cfg-layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.cfg-form-col { flex: 1; min-width: 0; }
.cfg-result-col { flex: 1; min-width: 0; position: sticky; top: 1rem; max-height: calc(100vh - 5rem); overflow-y: auto; }
@media (max-width: 1200px) {
    .cfg-layout { flex-direction: column; }
    .cfg-result-col { position: static; max-height: none; }
}
.cfg-card { background: white; border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem; }
.cfg-section-title { margin-bottom: 1rem; font-size: 1rem; font-weight: 600; }
.cfg-submit { background: #8ECCE4; color: white; border: none; padding: 0.7rem 2rem; border-radius: 8px; font-size: 0.95rem; font-weight: 600; cursor: pointer; margin-bottom: 1.5rem; }
.cfg-submit:hover { background: #7DBDD5; }
.cfg-label { font-size: 0.8rem; color: #64748b; display: block; margin-bottom: 0.25rem; }
.cfg-input { width: 100%; padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 8px; font-size: 0.9rem; }
.cfg-input:focus { outline: none; border-color: #8ECCE4; box-shadow: 0 0 0 3px rgba(142, 204, 228, 0.2); }
.cfg-btn-spread { background: #f8f9fa; border: 1px solid #d1d5db; border-radius: 8px; padding: 0.4rem 0.6rem; font-size: 0.8rem; color: #666; cursor: pointer; white-space: nowrap; }
.cfg-btn-spread:hover { background: #e7f3f8; border-color: #8ECCE4; }
.cfg-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.cfg-table-label { color: #64748b; width: 200px; padding: 0.35rem 0; }
.cfg-table-value { padding: 0.35rem 0; }
.cfg-override-badge { background: #fef3c7; color: #92400e; font-size: 0.7rem; padding: 1px 6px; border-radius: 4px; }

/* Kabelberekening — extends the .cfg-* pattern */
.kabel-form-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.kabel-form-row { grid-column: 1 / -1; }
.kabel-placeholder { color: #94a3b8; text-align: center; padding: 2rem 1rem; font-size: 0.9rem; }
@media (max-width: 1000px) {
    .cfg-layout { flex-direction: column; }
    .cfg-result-col { position: static; max-height: none; }
}
.kabel-radio-group { display: flex; gap: 1rem; align-items: center; }
.kabel-radio-group label { display: inline-flex; gap: 0.4rem; align-items: center; font-size: 0.9rem; color: #313131; cursor: pointer; }
.kabel-inputs-or { display: flex; gap: 1rem; align-items: end; }
.kabel-inputs-or > div { flex: 1; }
.kabel-inputs-or .form-or { align-self: center; color: #94a3b8; font-size: 0.85rem; padding-bottom: 0.5rem; }
.kabel-form-actions { display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem; }
.kabel-form-info { color: #64748b; font-size: 0.85rem; }
.kabel-summary { padding: 0.75rem 1rem; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 1rem; font-size: 0.9rem; }
.kabel-summary .warn { color: #dc2626; }
.kabel-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.kabel-table th, .kabel-table td { padding: 0.4rem 0.6rem; text-align: right; border-bottom: 1px solid #eef2f6; }
.kabel-table th { color: #64748b; font-weight: 600; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.03em; }
.kabel-table th:first-child, .kabel-table td:first-child { text-align: left; }
.kabel-table .row-ok td { color: #16a34a; }
.kabel-table .row-fail td { color: #dc2626; }
.kabel-table .row-recommended td { font-weight: 700; background: #e7f3f8; }

/* Config panel split layout */
.config-split { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.config-split-left { flex: 1; min-width: 0; }
.config-split-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 1200px) {
    .config-split { flex-direction: column; }
}
.config-extraction { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.config-extraction-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 2px 1.5rem; font-size: 0.8rem; }
.config-extraction-item { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid #eef2f6; }
.config-extraction-label { color: #64748b; }
.config-group-header { padding: 4px 0 2px; font-weight: 600; color: #64748b; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; background: #f8fafc; }
.config-result-card { background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.75rem 1rem; }
.config-result-card h3 { font-size: 0.9rem; margin-bottom: 0.5rem; color: #313131; }
.config-result-card table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.config-result-card td { padding: 0.15rem 0.5rem 0.15rem 0; }
.config-result-card td:first-child { color: #64748b; width: 45%; }
.config-upgrade-card { background: #e7f3f8; border: 1px solid #bee5eb; }

/* Manual editor */
.breadcrumb { font-size: 0.9rem; color: #64748b; margin-bottom: 1rem; }
.breadcrumb a { color: #8ECCE4; text-decoration: none; }
.breadcrumb .sep { color: #d1d5db; }
.breadcrumb .current { color: #313131; font-weight: 600; }
.breadcrumb .meta { color: #94a3b8; font-size: 0.8rem; margin-left: 0.75rem; }

.btn-sm { font-size: 0.85rem; padding: 0.4rem 1rem; margin-bottom: 0; }
a.btn-sm { text-decoration: none; display: inline-block; }

.component-label { display: block; margin-bottom: 0.4rem; font-size: 0.9rem; color: #313131; cursor: pointer; }
.component-label input[type="checkbox"] { margin-right: 0.4rem; }

.progress-track { background: #e0e0e0; border-radius: 4px; height: 20px; width: 100%; max-width: 500px; }
.progress-bar { background: #8ECCE4; height: 100%; border-radius: 4px; width: 0%; transition: width 0.3s; }

.tree-header { padding: 0.5rem 0.75rem; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #f8fafc; z-index: 1; }
.tree-header span { font-weight: 600; color: #313131; font-size: 0.85rem; }
.tree-btn { background: none; border: none; cursor: pointer; color: #64748b; font-size: 0.85rem; padding: 2px 4px; }
.tree-btn:hover { color: #313131; }
.tree-toggle { cursor: pointer; color: #64748b; user-select: none; display: flex; align-items: center; }
.tree-toggle span:last-child { color: #313131; font-weight: 500; }
.tree-arrow { font-size: 0.7rem; width: 12px; display: inline-block; }
.tree-file-row { display: flex; align-items: center; padding: 3px 8px 3px 0; cursor: pointer; color: #313131; border-radius: 4px; }
.tree-file-row:hover { background: #e7f3f8; }
.drop-highlight { background: #dbeafe; outline: 2px dashed #8ECCE4; outline-offset: -2px; border-radius: 4px; }
.tree-file-row.active { background: #e7f3f8; font-weight: 600; }
.tree-file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-delete { color: #dc3545; cursor: pointer; font-size: 0.75rem; opacity: 0; transition: opacity 0.15s; margin-left: auto; padding: 0 4px; }
.tree-file-row:hover .tree-delete { opacity: 1; }
.tree-dialog { display: none; padding: 0.5rem 0.75rem; border-bottom: 1px solid #e2e8f0; background: #fff; }
.tree-dialog input[type="text"] { flex: 1; padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.85rem; }
.tree-rename-input { padding: 1px 4px; border: 1px solid #8ECCE4; border-radius: 3px; font-size: inherit; outline: none; width: 100%; box-sizing: border-box; }

/* Context menu */
.ctx-menu { position: fixed; z-index: 1000; background: white; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); padding: 4px 0; min-width: 180px; font-size: 0.85rem; }
.ctx-menu-item { padding: 6px 14px; cursor: pointer; color: #313131; display: flex; align-items: center; gap: 8px; }
.ctx-menu-item:hover { background: #e7f3f8; }
.ctx-menu-item.danger { color: #dc3545; }
.ctx-menu-item.danger:hover { background: #fef2f2; }
.ctx-menu-sep { height: 1px; background: #e2e8f0; margin: 4px 0; }

.editor-app { display: flex; gap: 0; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; height: calc(100vh - 10rem); background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.editor-tree { width: 260px; min-width: 200px; border-right: 1px solid #e2e8f0; overflow-y: auto; background: #f8fafc; font-size: 0.85rem; }
.editor-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.editor-toolbar { padding: 0.5rem 1rem; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; background: #f8fafc; min-height: 44px; flex-shrink: 0; }
.editor-toolbar .filename { font-weight: 600; color: #313131; }
.editor-toolbar .meta { font-size: 0.8rem; color: #94a3b8; margin-left: 0.75rem; }
.editor-toolbar .dirty { color: #d97706; font-size: 0.8rem; margin-left: 0.5rem; display: none; }
.editor-content { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.editor-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: #94a3b8; }
.editor-split { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.editor-split + .editor-split { border-left: 1px solid #e2e8f0; }
.editor-pane-header { padding: 4px 12px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; font-size: 0.75rem; color: #64748b; }
.editor-textarea { flex: 1; padding: 12px; font-family: monospace; font-size: 13px; line-height: 1.6; border: none; resize: none; outline: none; color: #313131; min-width: 0; }
