/* ── Sidebar toggle button ── */
.sidebar-toggle {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    background: #2563EB;
    color: #fff;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 10px 8px;
    cursor: pointer;
    box-shadow: -2px 2px 8px rgba(0,0,0,.12);
    transition: background .2s;
}
.sidebar-toggle:hover {
    background: #1D4ED8;
}
.sidebar-toggle-icon {
    font-size: 1.3em;
}

/* ── Sidebar panel ── */
.sidebar-panel {
    position: fixed;
    right: -320px;
    top: 0;
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 1001;
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
    transition: right .3s ease;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', system-ui, sans-serif;
    overflow-y: auto;
}
.sidebar-panel.open {
    right: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 1000;
}
.sidebar-overlay.active {
    display: block;
}

/* ── Header ── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 8px;
    border-bottom: 1px solid #E5E7EB;
}
.sidebar-title {
    margin: 0;
    font-size: 1.05em;
    font-weight: 700;
    color: #1F2933;
}
.sidebar-close {
    background: none;
    border: none;
    font-size: 1.4em;
    color: #6B7280;
    cursor: pointer;
    padding: 0 4px;
}

/* ── Sections ── */
.sidebar-section {
    padding: 12px 16px;
}

/* ── Goals list ── */
.goals-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.goal-card {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 10px 12px;
    position: relative;
}
.goal-card.achieved {
    border-color: #10B981;
    background: #ECFDF5;
}
.goal-description {
    font-size: .85em;
    font-weight: 600;
    color: #1F2933;
    margin-bottom: 6px;
}
.goal-card.achieved .goal-description::before {
    content: '\2705 ';
}
.goal-progress-bar {
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.goal-progress-fill {
    height: 100%;
    background: #2563EB;
    border-radius: 3px;
    transition: width .4s ease;
}
.goal-card.achieved .goal-progress-fill {
    background: #10B981;
}
.goal-progress-text {
    font-size: .72em;
    color: #6B7280;
}
.goal-delete-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: #6B7280;
    cursor: pointer;
    font-size: .85em;
    padding: 2px 4px;
}
.goal-delete-btn:hover {
    color: #EF4444;
}

/* ── Add goal form ── */
.add-goal-form {
    padding: 12px 16px;
    border-top: 1px solid #E5E7EB;
}
.add-goal-form h4 {
    margin: 0 0 10px;
    font-size: .9em;
    color: #1F2933;
}
.sidebar-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: .85em;
    margin-bottom: 8px;
    background: #fff;
}
.goal-target-group {
    margin-bottom: 8px;
}
.goal-target-group label {
    font-size: .8em;
    color: #4B5563;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}
.add-goal-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.sidebar-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 6px;
    font-size: .82em;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}
.sidebar-btn-primary {
    background: #2563EB;
    color: #fff;
}
.sidebar-btn-primary:hover:not(:disabled) {
    background: #1D4ED8;
}
.sidebar-btn-primary:disabled {
    opacity: .5;
    cursor: default;
}
.sidebar-btn-secondary {
    background: #E5E7EB;
    color: #4B5563;
}
.sidebar-btn-secondary:hover {
    background: #D1D5DB;
}
.sidebar-add-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: none;
    border: 1px dashed #D1D5DB;
    border-radius: 8px;
    color: #6B7280;
    font-size: .84em;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .2s, color .2s;
}
.sidebar-add-btn:hover {
    border-color: #2563EB;
    color: #2563EB;
}

/* ── Missions ── */
.missions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mission-card {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 10px 12px;
}
.mission-card.completed {
    border-color: #8B5CF6;
    background: #F5F3FF;
}
.mission-description {
    font-size: .84em;
    font-weight: 600;
    color: #1F2933;
    margin-bottom: 6px;
}
.mission-card.completed .mission-description::before {
    content: '\1F31F ';
}
.mission-progress-bar {
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}
.mission-progress-fill {
    height: 100%;
    background: #8B5CF6;
    border-radius: 3px;
    transition: width .4s ease;
}
.mission-progress-text {
    font-size: .72em;
    color: #6B7280;
    display: flex;
    justify-content: space-between;
}
.mission-xp {
    color: #8B5CF6;
    font-weight: 700;
}

/* ── Empty state ── */
.sidebar-empty {
    text-align: center;
    padding: 16px 8px;
    color: #9CA3AF;
    font-size: .85em;
}

/* ── Mobile ── */
@media (max-width: 480px) {
    .sidebar-panel {
        width: 280px;
        right: -300px;
    }
    .sidebar-toggle {
        padding: 8px 6px;
    }
}
