:root {
    --bg: #f5e6d3; --card: #fff8f0; --primary: #8b5a2b; --accent: #d4a373;
    --text: #3e2723; --border: #c4a882; --shadow: 0 4px 12px rgba(139,90,43,0.15);
    --error: #dc3545; --success: #28a745; --warning: #ffc107;
}
/* CSS Version: 2026-04-10-20-00 */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; padding: 1rem; }
.container { max-width: 1280px; min-height: 768px; margin: 0 auto; }
.card { background: var(--card); border-radius: 12px; padding: 1.5rem; box-shadow: var(--shadow); border: 1px solid var(--border); }
.btn { background: var(--primary); color: #fff; padding: 0.6rem 1.2rem; border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; transition: 0.2s; text-decoration: none; display: inline-block; }
.btn:hover { background: var(--accent); color: var(--text); }
input, textarea, select { width: 100%; padding: 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: #fff; margin: 0.5rem 0; font-family: inherit; font-size: 0.95rem; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.quote { text-align: center; font-style: italic; font-size: 1.2rem; margin: 2rem 0; min-height: 3rem; }

/* Navigation */
.nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; padding: 1rem 0; border-bottom: 2px solid var(--border); }
.nav h2 { margin: 0; color: var(--primary); font-size: 1.5rem; }
.nav-user { display: flex; align-items: center; gap: 1.5rem; }
.username { font-weight: 600; color: var(--text); font-size: 1.1rem; }
.admin-link { color: var(--primary); text-decoration: none; font-weight: 500; padding: 0.5rem 1rem; border: 1px solid var(--primary); border-radius: 6px; }
.admin-link:hover { background: var(--primary); color: white; }
.logout-btn { color: var(--text); text-decoration: none; font-weight: 500; padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 6px; }
.logout-btn:hover { background: var(--border); }

/* Dashboard Layout */
.dashboard-layout { display: grid; grid-template-columns: 1fr 2fr; grid-template-rows: auto 1fr; gap: 1.5rem; min-height: calc(768px - 2rem); }
.profile-section { grid-column: 1; min-height: 0; display: flex; flex-direction: column; text-align: center; }
.topics-section { grid-column: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.management-section { grid-column: 1; min-height: 0; display: none; flex-direction: column; overflow: hidden; }
.chat-section { grid-column: 2; grid-row: 1 / span 2; }
.info-section { grid-column: 2; grid-row: 1 / span 2; display: none; }

@media (min-width: 1200px) and (min-height: 769px) {
    .dashboard-layout { height: calc(100vh - 2rem); }
}

.profile-info { text-align: left; background: rgba(139, 90, 43, 0.05); border-radius: 8px; padding: 0.75rem; }
.profile-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.3rem 0; }
.profile-row:last-of-type { border-bottom: none; }
.profile-icon { font-size: 1.3rem; width: 1.5rem; text-align: center; }
.profile-text { font-size: 0.95rem; color: var(--text); }
.profile-name { font-weight: 700; }
.profile-email { font-weight: 400; }
.profile-role { font-weight: 500; color: var(--primary); }
.profile-divider { height: 2px; background: linear-gradient(to right, var(--border), var(--accent), var(--border)); margin: 1rem 0; border-radius: 2px; }
.profile-actions { display: flex; gap: 0.5rem; margin: 1rem 0; }
.profile-actions .btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.profile-actions .btn.active { background: var(--accent); color: var(--text); }
.profile-logout { margin-top: 0.5rem; }
.profile-logout .logout-btn { width: 100%; background: #6c757d; color: white; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.profile-logout .logout-btn:hover { background: #5a6268; }
.logout-icon { font-size: 1.1rem; }
.chat-btn { margin-top: 1rem; width: 100%; }

/* Chat Section */
.chat-section { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-header { padding: 1rem; border-bottom: 1px solid var(--border); background: #fafafa; flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; }
.chat-header h3 { margin: 0; color: var(--primary); font-size: 1.1rem; }
.chat-scroll-buttons { display: flex; gap: 0.5rem; }
.scroll-btn { background: var(--primary); color: white; border: none; border-radius: 6px; width: 32px; height: 32px; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0.8; transition: all 0.2s; }
.scroll-btn:hover { opacity: 1; background: var(--accent); color: var(--text); transform: scale(1.05); }
.scroll-btn span { font-size: 0.9rem; line-height: 1; }
.arrow-up { transform: rotate(180deg); display: inline-block; }
.arrow-down { display: inline-block; }
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; background: #f9f9f9; min-height: 0; }
.message-item { margin-bottom: 0.5rem; }
.message-admin { background: #e3f2fd; padding: 0.75rem; border-radius: 12px 12px 12px 4px; word-wrap: break-word; overflow-wrap: break-word; }
.message-user { background: #d4edda; padding: 0.75rem; border-radius: 12px 12px 4px 12px; word-wrap: break-word; overflow-wrap: break-word; }
.message-content { color: var(--text); line-height: 1.5; margin-bottom: 0.25rem; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap; }
.message-time { color: #888; font-size: 0.75rem; display: block; text-align: right; }
.chat-input-area { display: flex; gap: 0.5rem; padding: 1rem; border-top: 1px solid var(--border); background: #fff; flex-shrink: 0; }
.chat-input-area textarea { flex: 1; resize: none; min-height: 40px; max-height: 120px; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 0.95rem; }
.chat-input-area textarea:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.send-message-btn { min-width: 50px; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.send-message-btn:hover { background: var(--accent); color: var(--text); }
.send-message-btn:disabled { background: #ccc; cursor: not-allowed; }
.send-message-btn span { padding-bottom: 3px; }

.instructions-section h3 { margin-bottom: 1rem; }
.instructions-scroll { max-height: 500px; overflow-y: auto; padding-right: 0.5rem; }
.instruction-item { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.instruction-item:last-child { border-bottom: none; }
.instruction-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.instruction-header strong { font-size: 1.1rem; color: var(--text); }
.instruction-header small { color: #666; font-size: 0.9rem; }
.calendar-icon { margin-right: 0.25rem; }
.instruction-content { line-height: 1.5; color: #555; }

.topics-section { text-align: left; display: flex; flex-direction: column; overflow: hidden; }
.topics-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.topics-header h3 { margin: 0; color: var(--primary); flex-shrink: 0; }
.topics-scroll-buttons { display: flex; gap: 0.5rem; }
.topics-scroll { flex: 1; overflow-y: auto; padding-right: 0.5rem; margin-bottom: 1rem; min-height: 0; }
.topics-list { display: flex; flex-direction: column; gap: 0.5rem; }
.topic-item { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem; border-radius: 8px; border: 1px solid var(--border); transition: background 0.2s; cursor: pointer; }
.topic-item:hover { background: rgba(212, 163, 115, 0.1); }
.topic-item.active { background: rgba(139, 90, 43, 0.15); border-color: var(--primary); }
.topic-title a { text-decoration: none; color: var(--text); font-weight: 500; }
.topic-title a:hover { color: var(--primary); }
.topic-date { color: #888; font-size: 0.85rem; margin-left: 1rem; white-space: nowrap; }
.topic-create-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.topic-create-form input { margin-bottom: 0.5rem; }
.create-topic-btn { width: 100%; background: var(--success); color: white; }
.create-topic-btn:hover { background: #218838; }
.no-data { text-align: center; color: #888; padding: 2rem 0; font-style: italic; }

.management-section { display: flex; flex-direction: column; }
.management-header { border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; margin-bottom: 1rem; }
.management-header h3 { margin: 0; color: var(--primary); font-size: 1.1rem; }
.management-list { display: flex; flex-direction: column; gap: 0.5rem; }
.management-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; transition: all 0.2s; }
.management-item:hover { background: rgba(212, 163, 115, 0.1); border-color: var(--primary); }
.management-icon { font-size: 1.3rem; }
.management-label { font-weight: 500; color: var(--text); }

.info-section { display: block; }
.info-header { border-bottom: 1px solid var(--border); padding-bottom: 0.75rem; margin-bottom: 1rem; }
.info-header h3 { margin: 0; color: var(--primary); font-size: 1.1rem; }
.info-content { flex: 1; overflow-y: auto; padding: 0.5rem 0; }
.info-content form { display: flex; flex-direction: column; gap: 0.5rem; }
.info-content form input { margin: 0; }
.info-content form button { margin-top: 0.5rem; }

/* Groups Interface */
.groups-interface { 
    display: flex; 
    flex-direction: column; 
    gap: 1.5rem; 
    height: calc(100% - 2rem);
}

.groups-toggle { display: flex; gap: 0.5rem; }
.toggle-btn { flex: 1; padding: 0.75rem; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--text); transition: all 0.2s; }
.toggle-btn:hover { background: rgba(212, 163, 115, 0.1); border-color: var(--primary); }
.toggle-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.groups-list-container { 
    flex: 1; 
    overflow-y: auto; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    padding: 0.5rem; 
    background: #fff; 
    min-height: 0;
}
.groups-list { display: flex; flex-direction: column; gap: 0.75rem; }
.group-item { padding: 1rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.group-item:hover { background: rgba(212, 163, 115, 0.1); border-color: var(--primary); }
.group-item.selected { background: rgba(139, 90, 43, 0.15); border-color: var(--primary); }
.group-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.group-name { font-weight: 600; color: var(--text); font-size: 1rem; }
.group-date { color: #888; font-size: 0.8rem; white-space: nowrap; margin-left: 1rem; }
.group-description { color: #555; font-size: 0.9rem; line-height: 1.4; }

.groups-actions { 
    display: flex; 
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.groups-btn { flex: 1; background: var(--primary); color: white; padding: 0.75rem; }
.groups-btn:hover { background: var(--accent); color: var(--text); }
.groups-btn:disabled { background: #ccc; cursor: not-allowed; }

.slide-form-wrapper {
    overflow: hidden;
    display: none;
}
.slide-form-wrapper.active {
    display: flex;
    flex-direction: column;
}

/* Slide Form */
.slide-form { 
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}
.slide-form.active {
    transform: translateY(0);
}
.form-content { padding: 1rem; }
.form-content h4 { margin-bottom: 1rem; color: var(--primary); }
.form-content input, .form-content textarea { margin-bottom: 0.75rem; }
.form-content .btn { margin-right: 0.5rem; }
.btn-cancel { background: #6c757d; color: white; }
.btn-cancel:hover { background: #5a6268; }

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: var(--card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 400px;
    width: 90%;
}
.modal-content h4 { margin-bottom: 1rem; color: var(--primary); }
.modal-content p { margin-bottom: 1.5rem; color: var(--text); }
.modal-actions { display: flex; gap: 0.5rem; }
.modal-actions .btn { flex: 1; }
.btn-confirm { background: var(--success); color: white; }
.btn-confirm:hover { background: #218838; }

/* Admin Panel */
.admin-panel { max-width: 1400px; margin: 0 auto; }
.admin-header { border-bottom: 3px solid var(--primary); }
.header-content { display: flex; justify-content: space-between; align-items: center; }
.header-content h2 { margin: 0; color: var(--primary); }
.register-btn { background: var(--success); color: white; }
.register-btn:hover { background: #218838; }

.users-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1.5rem; margin-top: 1.5rem; }
.user-card { border-left: 4px solid var(--primary); transition: transform 0.2s; }
.user-card:hover { transform: translateY(-4px); }
.user-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.user-avatar { width: 50px; height: 50px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: bold; }
.user-info h3 { margin: 0; color: var(--text); }
.user-email { color: #666; font-size: 0.9rem; margin: 0.25rem 0 0; }

.user-stats { display: flex; justify-content: space-around; margin: 1.5rem 0; padding: 1rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stat-item { text-align: center; }
.stat-label { display: block; color: #888; font-size: 0.85rem; }
.stat-value { display: block; font-size: 1.5rem; font-weight: bold; color: var(--primary); }

.admin-actions h4 { margin: 0 0 1rem; color: var(--text); }
.info-form textarea { resize: vertical; min-height: 80px; }
.publish-btn { background: var(--success); color: white; }
.publish-btn:hover { background: #218838; }
.chat-link-btn { background: var(--accent); color: var(--text); }
.chat-link-btn:hover { background: #c2935d; }

.empty-card { text-align: center; padding: 3rem; }
.no-users { color: #666; font-size: 1.1rem; }
.no-users a { color: var(--primary); text-decoration: none; font-weight: 500; }
.no-users a:hover { text-decoration: underline; }

/* Animations */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* Message Cards */
.message-card { background: #e0f0e0; border-left: 4px solid var(--success); }
.message-card.error { background: #ffe0e0; border-left-color: var(--error); }

/* Chat Messages in chat.html */
.msg { margin-bottom: 0.5rem; padding: 0.75rem; border-radius: 12px; }
.msg.admin { background: #e3f2fd; }
.msg.user { background: #d4edda; }
.msg p { margin-top: 0.3rem; margin-bottom: 0; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap; }

@media (min-width: 769px) {
    .dashboard-layout { height: calc(100vh - 2rem); }
}

/* Responsive */
@media (max-width: 900px) {
    .dashboard-layout { grid-template-columns: 1fr; }
    .chat-section { grid-column: 1; grid-row: auto; }
    .topics-section { grid-column: 1; grid-row: auto; }
    .users-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { height: auto; overflow-y: auto; }
    .dashboard-layout { height: auto; min-height: none; }
    .chat-section { max-height: none; }
    .nav { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .nav-user { flex-direction: column; align-items: flex-start; gap: 0.5rem; width: 100%; }
    .admin-link, .logout-btn { width: 100%; text-align: center; }
    .header-content { flex-direction: column; gap: 1rem; align-items: flex-start; }
    .user-stats { flex-direction: column; gap: 0.75rem; }
    .form-actions { flex-direction: column; }
}

/* Participants Interface */
.participants-interface { 
    display: flex; 
    flex-direction: column; 
    gap: 1.5rem; 
    height: calc(100% - 2rem);
}

.participants-toggle { display: flex; gap: 0.5rem; }

.participants-list-container { 
    flex: 1; 
    overflow-y: auto; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
    padding: 0.5rem; 
    background: #fff; 
    min-height: 0;
}
.participants-list { display: flex; flex-direction: column; gap: 0.75rem; }
.participant-item { padding: 1rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.participant-item:hover { background: rgba(212, 163, 115, 0.1); border-color: var(--primary); }
.participant-item.selected { background: rgba(139, 90, 43, 0.15); border-color: var(--primary); }
.participant-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.participant-name { font-weight: 600; color: var(--text); font-size: 1rem; }
.participant-date { color: #888; font-size: 0.8rem; white-space: nowrap; margin-left: 1rem; }
.participant-details { display: flex; align-items: center; gap: 0.5rem; }
.participant-detail-item { color: #555; font-size: 0.9rem; white-space: nowrap; }
.participant-detail-separator { color: #aaa; font-size: 0.8rem; }

.participants-actions { 
    display: flex; 
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.participants-btn { flex: 1; background: var(--primary); color: white; padding: 0.75rem; }
.participants-btn:hover { background: var(--accent); color: var(--text); }
.participants-btn:disabled { background: #ccc; cursor: not-allowed; }

/* Composition Interface */
#composition-section {
    display: none;
    grid-column: 2;
    grid-row: 1 / span 2;
}

#composition-section .info-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
}

#composition-section .info-header h3 {
    margin: 0;
    color: var(--primary);
    font-size: 1.1rem;
}

.composition-interface { 
    display: flex; 
    flex-direction: column; 
    gap: 1rem;
    height: calc(100% - 4rem);
    overflow: hidden;
}

.composition-lists {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.composition-groups-container,
.composition-participants-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.composition-subheader {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
    flex-shrink: 0;
}

.composition-subheader h4 {
    margin: 0;
    color: var(--primary);
    font-size: 1rem;
}

.composition-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
}

.composition-list .group-item,
.composition-list .participant-item {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.composition-list .group-item:hover,
.composition-list .participant-item:hover {
    background: rgba(212, 163, 115, 0.1);
    border-color: var(--primary);
}

.composition-list .group-item.selected {
    background: rgba(139, 90, 43, 0.15);
    border-color: var(--primary);
    font-weight: 600;
}

.composition-list .participant-item.selected {
    background: rgba(139, 90, 43, 0.25);
    border-color: var(--primary);
    border-width: 2px;
}

.composition-list .participant-item.participant-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
}

.composition-list .participant-item.participant-disabled:hover {
    background: #f5f5f5;
    border-color: var(--border);
}

.composition-list .group-title,
.composition-list .participant-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.css-version-footer {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 1rem;
    text-align: center;
    font-size: 0.75rem;
    color: #888;
}

/* Files section styles */
.files-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    background: rgba(139, 90, 43, 0.05);
    border-radius: 8px;
    margin-left: 1rem;
}
.files-stats .stat-item {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
.files-stats .stat-item.strong,
.files-stats .stat-item.changed {
    color: #d4a373;
}
.files-stats .stat-item.new {
    color: #28a745;
}
.files-stats strong {
    font-weight: 700;
}
.files-info {
    background: rgba(139, 90, 43, 0.05);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}
.files-hint {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
    line-height: 1.4;
}
.files-tree-container {
    max-height: 500px;
    overflow-y: auto;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}
.files-tree {
    min-height: 200px;
}
.file-tree-item {
    padding: 0.25rem 0;
    cursor: pointer;
    user-select: none;
}
.file-tree-item:hover {
    background: rgba(212, 163, 115, 0.1);
    border-radius: 4px;
}
.file-tree-item.dir {
    font-weight: 600;
    color: var(--primary);
}
.file-tree-item.file {
    padding-left: 1rem;
    color: #555;
}
.file-tree-item.changed {
    background: rgba(212, 163, 115, 0.2);
    border-left: 3px solid #d4a373;
    padding-left: 0.5rem;
}
.file-tree-item.new {
    background: rgba(40, 167, 69, 0.1);
    border-left: 3px solid #28a745;
    padding-left: 0.5rem;
}
.file-tree-item .file-icon {
    display: inline-block;
    width: 1.2rem;
    margin-right: 0.25rem;
}
.file-tree-item .file-meta {
    font-size: 0.75rem;
    color: #888;
    margin-left: 0.5rem;
}
.file-tree-children {
    border-left: 1px dashed var(--border);
}
.file-tree-item.collapsed + .file-tree-children {
    display: none;
}
.file-tree-toggle {
    display: inline-block;
    width: 1rem;
    text-align: center;
    transition: transform 0.2s;
    font-size: 0.7rem;
    color: #888;
}
.file-tree-item.collapsed .file-tree-toggle {
    transform: rotate(-90deg);
}
.files-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.files-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.files-btn span {
    font-size: 1.1rem;
}