* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    padding: 10px;
    line-height: 1.5;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

h1 {
    font-size: 1.4rem;
    color: #2c3e50;
}

.btn {
    padding: 8px 14px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn:hover {
    background-color: #2980b9;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.tree-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 15px;
    min-height: 300px;
}

.tree ul {
    list-style: none;
    padding-left: 20px;
}

.tree li {
    margin: 6px 0;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.tree li:hover {
    background-color: #f1f3f5;
}

.node {
    font-weight: 600;
    color: #2c3e50;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.node::before {
    content: "📁";
    font-size: 1.1em;
}

.leaf {
    color: #555;
}

.leaf::before {
    content: "📄";
}

.toggle {
    display: inline-block;
    width: 18px;
    text-align: center;
    font-weight: bold;
    color: #3498db;
    cursor: pointer;
    user-select: none;
}

.status {
    margin-top: 10px;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
}

/* Адаптация под тёмную тему Telegram */
body.theme-dark {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

body.theme-dark .tree-container {
    background: #2d2d2d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.theme-dark .node {
    color: #a0d8ff;
}