* { box-sizing: border-box; }
body {
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    margin: 0;
    background: #f4f5f7;
    color: #222;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1f2937;
    color: #fff;
    padding: 12px 24px;
}
.topbar .brand { color: #fff; font-weight: bold; font-size: 18px; }
.topbar nav a { color: #d1d5db; margin-left: 16px; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; }

.container { max-width: 900px; margin: 32px auto; padding: 0 16px; }

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-box {
    background: #fff; padding: 32px; border-radius: 8px; width: 340px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.auth-box h1 { margin: 0 0 4px; font-size: 20px; }
.auth-box h2 { margin: 0 0 16px; font-size: 15px; color: #666; font-weight: normal; }
.auth-box label { display: block; margin-bottom: 12px; font-size: 13px; color: #444; }
.auth-box input { width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #ccc; border-radius: 4px; }
.auth-box button, main button, .modal button {
    background: #2563eb; color: #fff; border: none; padding: 8px 14px;
    border-radius: 4px; cursor: pointer; font-size: 14px;
}
.auth-box button:hover { background: #1d4ed8; }

.msg-error { color: #b91c1c; background: #fee2e2; padding: 8px 12px; border-radius: 4px; }
.msg-success { color: #166534; background: #dcfce7; padding: 8px 12px; border-radius: 4px; }

.new-project-form { display: flex; gap: 8px; margin: 16px 0 24px; }
.new-project-form input { flex: 1; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }

.project-list { list-style: none; padding: 0; }
.project-list li {
    display: flex; align-items: center; gap: 12px;
    background: #fff; padding: 12px 16px; margin-bottom: 8px; border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.project-list li a { font-weight: 600; flex: 1; }
.muted { color: #888; font-size: 13px; }

.inline-form { display: inline-block; margin: 0; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }

.user-table { width: 100%; border-collapse: collapse; background: #fff; }
.user-table th, .user-table td { padding: 8px 10px; border-bottom: 1px solid #eee; text-align: left; font-size: 13px; }
.status { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.actions form { margin-right: 4px; }

#add-root-btn { margin-bottom: 16px; }

.tree, .tree ul { list-style: none; padding-left: 20px; margin: 0; }
.tree { padding-left: 0; }
.tree-node { margin: 2px 0; }
.node-row {
    display: flex; align-items: center; gap: 6px;
    background: #fff; border-radius: 4px; padding: 5px 8px;
}
.node-toggle {
    width: 16px; cursor: pointer; user-select: none; color: #666; text-align: center;
}
.node-icon { width: 18px; text-align: center; }
.node-name { flex: 1; }
.node-edit-btn, .node-add-btn {
    cursor: pointer; border: none; background: transparent; color: #666; font-size: 14px;
    padding: 2px 6px;
}
.node-edit-btn:hover, .node-add-btn:hover { color: #2563eb; }
.node-children.hidden { display: none; }

.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-box {
    background: #fff; padding: 24px; border-radius: 8px; width: 320px;
}
.modal-box h2 { margin-top: 0; font-size: 16px; }
.modal-box label { display: block; margin-bottom: 12px; font-size: 13px; color: #444; }
.modal-box input, .modal-box select { width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #ccc; border-radius: 4px; }
.modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.modal-actions button { flex: 1; }
.modal-actions button:not(.primary):not(.danger) { background: #9ca3af; }
