/* ── Lesson Planner specific ─────────────────────────────────────── */

        .tabs {
            display: flex;
            gap: 0;
            border-bottom: var(--border-sketch);
            margin-bottom: 28px;
        }

        .tab {
            font-family: var(--font-hand);
            font-size: 1.2rem;
            font-weight: 700;
            padding: 10px 28px;
            background: transparent;
            border: var(--border-sketch);
            border-bottom: none;
            border-radius: var(--radius) var(--radius) 0 0;
            cursor: pointer;
            color: var(--ink-light);
            margin-bottom: -2px;
            position: relative;
        }

        .tab.active {
            background: var(--paper);
            color: var(--ink);
            border-bottom: 2px solid var(--paper);
            z-index: 1;
        }

        .tab-panel { display: none; }
        .tab-panel.active { display: block; }

        /* ── Plan cards grid ─────────────────────────────────────────────── */

        .plans-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }

        .plan-card {
            background: var(--paper-warm);
            border: var(--border-sketch);
            border-radius: var(--radius);
            padding: 20px;
            cursor: pointer;
            transition: transform 0.1s, box-shadow 0.1s;
            position: relative;
        }

        .plan-card:hover {
            transform: translate(-2px, -2px);
            box-shadow: var(--shadow-lift);
        }

        .plan-card-title {
            font-family: var(--font-body); font-weight: 700;
            font-size: 1.2rem;
            margin-bottom: 6px;
        }

        .plan-card-desc {
            font-family: var(--font-hand);
            font-size: 1rem;
            color: var(--ink-light);
            margin-bottom: 12px;
            line-height: 1.4;
        }

        .plan-card-meta {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            font-family: var(--font-hand);
            font-size: 0.95rem;
            color: var(--ink-faint);
            align-items: center;
        }

        .plan-card-meta .badge {
            font-size: 0.85rem;
            padding: 2px 10px;
            border-radius: 20px;
            font-family: var(--font-hand);
            font-weight: 700;
        }

        .badge-public {
            background: var(--accent-gold-light);
            color: var(--accent-gold);
            border: 1px solid var(--accent-gold);
        }

        .badge-private {
            background: var(--paper-alt);
            color: var(--ink-faint);
            border: var(--border-light);
        }

        .plan-card-actions {
            position: absolute;
            top: 12px;
            right: 12px;
            display: flex;
            gap: 6px;
            opacity: 0;
            transition: opacity 0.15s;
        }

        .plan-card:hover .plan-card-actions { opacity: 1; }

        /* ── Time chip ───────────────────────────────────────────────────── */

        .time-chip {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            background: var(--accent-red-light);
            color: var(--accent-red);
            border: 1px solid var(--accent-red);
            border-radius: 20px;
            padding: 2px 10px;
            font-family: var(--font-hand);
            font-weight: 700;
            font-size: 0.95rem;
        }

        .use-chip {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            background: var(--paper-alt);
            color: var(--ink-faint);
            border: var(--border-light);
            border-radius: 20px;
            padding: 2px 10px;
            font-family: var(--font-hand);
            font-size: 0.95rem;
        }

        /* ── Plan editor ─────────────────────────────────────────────────── */

        #planEditor {
            display: none;
        }

        #planEditor.active {
            display: block;
        }

        .editor-header {
            display: flex;
            align-items: center;
            gap: 16px;
            margin-bottom: 24px;
            flex-wrap: wrap;
        }

        .editor-header h2 {
            flex: 1;
            min-width: 200px;
        }

        .settings-row {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            gap: 16px;
            margin-bottom: 24px;
        }

        /* ── Setlist / segments ──────────────────────────────────────────── */

        .setlist-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
            flex-wrap: wrap;
            gap: 10px;
        }

        .setlist-header h3 {
            font-family: var(--font-body); font-weight: 700;
        }

        .time-budget {
            font-family: var(--font-hand);
            font-size: 1.3rem;
            font-weight: 700;
            padding: 6px 18px;
            border: var(--border-sketch);
            border-radius: var(--radius);
            background: var(--paper-warm);
        }

        .time-budget.over { color: var(--accent-red); border-color: var(--accent-red); }
        .time-budget.full { color: var(--success); border-color: var(--success); }
        .time-budget.under { color: var(--accent-gold); border-color: var(--accent-gold); }

        .segment-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 16px;
        }

        .segment-item {
            background: var(--paper-warm);
            border: var(--border-sketch);
            border-radius: var(--radius);
            padding: 14px 16px;
            display: grid;
            grid-template-columns: auto 1fr auto auto auto;
            gap: 12px;
            align-items: start;
        }

        .segment-number {
            font-family: var(--font-body); font-weight: 700;
            font-size: 1.3rem;
            color: var(--ink-faint);
            padding-top: 6px;
            min-width: 28px;
            text-align: center;
        }

        .segment-main { min-width: 0; }

        .segment-title {
            font-family: var(--font-hand);
            font-size: 1.1rem;
            font-weight: 700;
            margin-bottom: 6px;
        }

        .segment-notes input {
            width: 100%;
            font-family: var(--font-hand);
            font-size: 1rem;
            background: transparent;
            border: none;
            border-bottom: 1px dashed var(--ink-faint);
            outline: none;
            color: var(--ink-light);
            padding: 2px 0;
        }

        .segment-notes input::placeholder { color: var(--ink-faint); }

        .segment-duration {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }

        .segment-duration input {
            width: 56px;
            text-align: center;
            font-family: var(--font-hand);
            font-size: 1.1rem;
            font-weight: 700;
            border: var(--border-sketch);
            border-radius: var(--radius);
            padding: 4px 6px;
            background: var(--paper);
        }

        .segment-duration label {
            font-family: var(--font-hand);
            font-size: 0.85rem;
            color: var(--ink-faint);
        }

        .segment-reorder {
            display: flex;
            flex-direction: column;
            gap: 4px;
            padding-top: 4px;
        }

        .segment-reorder button {
            background: none;
            border: var(--border-light);
            border-radius: 2px;
            cursor: pointer;
            padding: 2px 6px;
            font-size: 0.8rem;
            color: var(--ink-faint);
            line-height: 1;
        }

        .segment-reorder button:hover {
            border-color: var(--ink);
            color: var(--ink);
        }

        .segment-remove {
            background: none;
            border: none;
            cursor: pointer;
            color: var(--ink-faint);
            font-size: 1.1rem;
            padding: 4px;
            line-height: 1;
            align-self: start;
        }

        .segment-remove:hover { color: var(--accent-red); }

        .empty-setlist {
            text-align: center;
            padding: 32px 20px;
            border: 2px dashed var(--ink-faint);
            border-radius: var(--radius);
            margin-bottom: 16px;
            color: var(--ink-faint);
            font-family: var(--font-hand);
            font-size: 1.1rem;
        }

        /* ── Exercise picker modal ───────────────────────────────────────── */

        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.5);
            z-index: 500;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .modal-overlay.hidden { display: none; }

        .modal {
            background: var(--paper);
            border: var(--border-sketch);
            border-radius: var(--radius);
            max-width: 600px;
            width: 100%;
            max-height: 80vh;
            display: flex;
            flex-direction: column;
            box-shadow: 6px 6px 0 rgba(0,0,0,0.15);
        }

        .modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 20px 24px 16px;
            border-bottom: var(--border-light);
        }

        .modal-close {
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--ink-faint);
            line-height: 1;
        }

        .modal-close:hover { color: var(--ink); }

        .modal-body {
            flex: 1;
            overflow-y: auto;
            padding: 16px 24px 24px;
        }

        .exercise-picker-item {
            padding: 12px 14px;
            border: var(--border-light);
            border-radius: var(--radius);
            margin-bottom: 8px;
            cursor: pointer;
            transition: background 0.1s;
            font-family: var(--font-hand);
        }

        .exercise-picker-item:hover {
            background: var(--paper-warm);
            border-color: var(--ink);
        }

        .exercise-picker-item .ex-title {
            font-size: 1.1rem;
            font-weight: 700;
        }

        .exercise-picker-item .ex-meta {
            font-size: 0.95rem;
            color: var(--ink-faint);
            margin-top: 4px;
        }

        /* ── Community filter bar ────────────────────────────────────────── */

        .filter-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 16px;
        }

        .filter-btn {
            font-family: var(--font-hand);
            font-size: 1rem;
            font-weight: 600;
            padding: 6px 16px;
            background: transparent;
            border: var(--border-sketch);
            border-radius: 20px;
            cursor: pointer;
            color: var(--ink-light);
        }

        .filter-btn.active {
            background: var(--ink);
            color: var(--paper);
        }

        /* ── Search bar ──────────────────────────────────────────────────── */

        .search-bar {
            margin-bottom: 16px;
        }

        /* ── Tags ────────────────────────────────────────────────────────── */

        .tag {
            display: inline-block;
            font-family: var(--font-hand);
            font-size: 0.9rem;
            padding: 2px 10px;
            background: var(--paper-alt);
            border: var(--border-light);
            border-radius: 20px;
            color: var(--ink-light);
        }

        /* ── Community plan card ─────────────────────────────────────────── */

        .community-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
            margin-top: 20px;
        }

        .community-card {
            background: var(--paper-warm);
            border: var(--border-sketch);
            border-radius: var(--radius);
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .community-card-title {
            font-family: var(--font-body); font-weight: 700;
            font-size: 1.15rem;
        }

        .community-card-desc {
            font-family: var(--font-hand);
            font-size: 1rem;
            color: var(--ink-light);
            flex: 1;
            line-height: 1.4;
        }

        .community-card-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 8px;
            margin-top: 4px;
        }

        /* ── Login gate ──────────────────────────────────────────────────── */

        .login-gate {
            text-align: center;
            padding: 48px 20px;
            border: 2px dashed var(--ink-faint);
            border-radius: var(--radius);
            font-family: var(--font-hand);
        }

        .login-gate p {
            font-size: 1.2rem;
            color: var(--ink-light);
            margin-bottom: 20px;
        }

        /* ── Misc ────────────────────────────────────────────────────────── */

        .mt-sm { margin-top: 8px; }
        .mt-md { margin-top: 16px; }
        .mt-lg { margin-top: 32px; }
        .mb-lg { margin-bottom: 32px; }

        .flex-between {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 12px;
        }

        .form-input select, select.form-input {
            appearance: none;
            -webkit-appearance: none;
        }

        @media (max-width: 640px) {
            .segment-item {
                grid-template-columns: auto 1fr;
                grid-template-rows: auto auto;
            }

            .segment-duration, .segment-reorder, .segment-remove {
                grid-column: 2;
            }
        }
