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

/* Topbar */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px; background: #1f2937; color: white; flex-wrap: wrap; gap: 8px;
}
.topbar .brand { font-weight: 600; font-size: 18px; }
.user-info { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.role-badge {
    padding: 2px 8px; border-radius: 4px; background: rgba(255,255,255,0.15); font-size: 12px;
}
.inline-form { display: inline; }
.btn-link {
    background: none; border: none; color: #93c5fd; cursor: pointer; padding: 0; font: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 6px 12px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-size: 14px;
}
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: white; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #f3f4f6; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-icon {
    background: none; border: 1px solid #d1d5db; border-radius: 4px;
    padding: 4px 10px; cursor: pointer; font-size: 13px; margin-left: 4px; color: #111827;
}
.btn-icon:hover { background: #f3f4f6; }
.btn-icon-muted { color: #9ca3af; }
.btn-rehearse { background: #dcfce7; color: #166534; border-color: #86efac; }
.btn-rehearse:hover { background: #bbf7d0; }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
h2 { font-size: 18px; margin: 24px 0 12px; }
h3 { font-size: 14px; margin: 16px 0 8px; color: #4b5563; text-transform: uppercase; letter-spacing: 0.5px; }

/* Plan */
.plan-section { background: white; border-radius: 12px; padding: 16px 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.plan-block { margin-bottom: 16px; }
.plan-block:last-child { margin-bottom: 0; }

.song-list { list-style: none; padding: 0; margin: 0; }
.song-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 4px; border-bottom: 1px solid #f1f5f9;
}
.song-item:last-child { border-bottom: none; }
.song-title { flex: 0 0 auto; font-weight: 500; }
.song-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.song-list-done .song-title { color: #6b7280; text-decoration: line-through; }

.progress-bar {
    flex: 1; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; min-width: 80px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #fbbf24, #10b981);
    transition: width 0.3s;
}

.badge { font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.badge-new { background: #fef3c7; color: #92400e; font-weight: 700; }

.rest-section, .incomplete-section {
    background: white; border-radius: 12px; padding: 16px 20px; margin-top: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.song-list-warn .song-item { background: #fef2f2; }

/* Login */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-form {
    background: white; padding: 32px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    width: 320px; display: flex; flex-direction: column; gap: 14px;
}
.login-form h1 { margin: 0 0 4px; font-size: 22px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #4b5563; }
.login-form input { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; }
.login-form button {
    padding: 10px; background: #2563eb; color: white; border: none; border-radius: 6px;
    cursor: pointer; font-size: 14px;
}
.flash { padding: 8px 12px; border-radius: 6px; font-size: 14px; }
.flash-error { background: #fef2f2; color: #991b1b; }

/* Modal */
.modal {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100;
    align-items: center; justify-content: center; padding: 16px;
}
.modal.modal-open { display: flex; }
.modal-content {
    background: white; border-radius: 12px; padding: 24px; width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
}
.modal-content h3 { margin-top: 0; text-transform: none; letter-spacing: 0; color: #111827; font-size: 18px; }
.modal-content form { display: flex; flex-direction: column; gap: 12px; }
.modal-content label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #4b5563; }
.modal-content label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.modal-content input[type=text],
.modal-content input[type=password],
.modal-content input[type=number],
.modal-content textarea,
.modal-content select {
    padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 14px; font-family: inherit;
}
.modal-readonly { font-size: 12px; color: #6b7280; padding: 8px; background: #f9fafb; border-radius: 6px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.data-table th, .data-table td { text-align: left; padding: 8px; border-bottom: 1px solid #e5e7eb; }
.data-table th { background: #f9fafb; font-weight: 600; }
.row-actions { display: flex; gap: 8px; margin-top: 8px; }

/* Toast */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
    padding: 10px 20px; border-radius: 8px; font-size: 14px; color: white;
    opacity: 0; transition: all 0.25s; pointer-events: none; z-index: 200;
}
.toast.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-ok { background: #059669; }
.toast-error { background: #dc2626; }

.import-report {
    font-size: 13px; max-height: 200px; overflow-y: auto;
    background: #f9fafb; padding: 8px; border-radius: 6px;
}
.import-report ul { padding-left: 20px; margin: 8px 0 0; }
.search-results {
    max-height: 220px; overflow-y: auto; background: #f9fafb;
    border-radius: 6px; padding: 4px 8px; margin-top: 8px;
}

@media (max-width: 640px) {
    .song-item { flex-wrap: wrap; }
    .progress-bar { width: 100%; order: 3; margin-top: 6px; }
}