﻿        /* MODAL */
        .modal-overlay {
            position: fixed;
            inset: 0;
            z-index: 100;
            background: rgba(2,4,8,0.85);
            backdrop-filter: blur(6px);
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.25s;
        }

            .modal-overlay.open {
                opacity: 1;
                pointer-events: all;
            }

        .modal {
            background: var(--panel);
            border: 1px solid var(--border);
            border-radius: 12px;
            width: 520px;
            max-width: 95vw;
            max-height: 85vh;
            overflow-y: auto;
            padding: 28px;
            box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(74,158,255,0.1);
            transform: translateY(20px);
            transition: transform 0.25s;
        }

        .modal-overlay.open .modal {
            transform: none;
        }

        .modal-title {
            font-family: 'Cinzel', serif;
            font-size: 18px;
            font-weight: 600;
            margin-bottom: 4px;
        }

        .modal-sub {
            font-size: 13px;
            color: var(--text-mid);
            margin-bottom: 20px;
        }

        .modal-content {
            width: min(100%, 32rem);
            max-height: calc(100dvh - 2rem);
            overflow-y: auto;
            overscroll-behavior: contain;
        }

        .form-group {
            margin-bottom: 16px;
        }

        .form-label {
            font-family: 'Cinzel', serif;
            font-size: 10px;
            letter-spacing: 2px;
            color: var(--text-mid);
            display: block;
            margin-bottom: 6px;
        }

        .form-input, .form-select, .form-textarea {
            width: 100%;
            background: rgba(5,13,24,0.8);
            border: 1px solid var(--border);
            border-radius: 6px;
            padding: 9px 12px;
            color: var(--text-bright);
            font-family: 'Crimson Pro', serif;
            /* Keep >=16px at all times: iOS Safari (and some Chrome builds) auto-zoom
               the viewport on focus when a form control's computed font-size is below
               16px. Using 16px unconditionally avoids relying on a mobile-only override. */
            font-size: 16px;
            outline: none;
            transition: border-color 0.2s;
        }

            .form-input:focus, .form-select:focus, .form-textarea:focus {
                border-color: var(--glow-blue);
                box-shadow: 0 0 0 2px rgba(74,158,255,0.1);
            }

            .form-select option {
                background: var(--panel);
            }

        .form-textarea {
            resize: vertical;
            min-height: 70px;
        }

        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .modal-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
            margin-top: 20px;
        }

        .btn-cancel {
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text-mid);
        }

            .btn-cancel:hover {
                border-color: var(--text-mid);
                color: var(--text-bright);
            }

        /* TAB NAV */
        .tab-nav {
            display: flex;
            gap: 2px;
            margin-bottom: 16px;
        }

        .tab-btn {
            flex: 1;
            font-family: 'Cinzel', serif;
            font-size: 9px;
            letter-spacing: 2px;
            padding: 7px;
            border-radius: 4px;
            cursor: pointer;
            border: none;
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text-dim);
            transition: all 0.2s;
        }

            .tab-btn.active {
                background: rgba(74,158,255,0.1);
                border-color: var(--glow-blue);
                color: var(--glow-blue);
            }

        /* INLINE "CREATE SKILL" FORM (integration mapping modal) */
        .inline-create-container:not(:empty) {
            margin-top: 10px;
        }

        .inline-create-form {
            border: 1px solid var(--glow-blue);
            border-radius: 8px;
            padding: 12px;
            background: rgba(74,158,255,0.05);
            max-width: 100%;
            box-sizing: border-box;
        }

            .inline-create-form .form-group {
                margin-bottom: 10px;
            }

            .inline-create-form .form-input {
                width: 100%;
                box-sizing: border-box;
            }

        .inline-create-error {
            font-family: 'Share Tech Mono', monospace;
            font-size: 10px;
            color: var(--glow-red);
            margin: -4px 0 10px;
        }

        .inline-create-hint {
            font-family: 'Share Tech Mono', monospace;
            font-size: 10px;
            color: var(--text-dim);
            line-height: 1.5;
            margin-bottom: 10px;
        }

        .inline-create-actions {
            display: flex;
            gap: 8px;
            justify-content: flex-end;
            flex-wrap: wrap;
        }

            .inline-create-actions .btn {
                font-size: 9px;
            }

        @media (max-width: 480px) {
            .inline-create-actions {
                justify-content: stretch;
            }

                .inline-create-actions .btn {
                    flex: 1;
                }
        }

        /* SKILL DETAIL MODAL — single scrollable content area between the
           fixed header/tabs and the fixed footer actions. The outer .modal
           already caps overall height (max-height:85vh); this inner area
           is the only element that scrolls, avoiding nested/double scrollbars. */
        .modal-scroll-area {
            overflow-y: auto;
            overflow-x: hidden;
            max-height: min(50vh, 420px);
            padding-right: 2px;
        }

        .skill-activity-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .skill-activity-status {
            font-family: 'Share Tech Mono', monospace;
            font-size: 11px;
            color: var(--text-dim);
            text-align: center;
            padding: 12px 4px;
        }

        /* Reuses .activity-item's card look but omits the icon column and
           allows the title to wrap to two lines instead of truncating. */
        .skill-activity-item {
            align-items: flex-start;
        }

        .skill-activity-title {
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            word-break: break-word;
        }

        .skill-activity-expand {
            background: none;
            border: none;
            padding: 0;
            margin-top: 2px;
            font-family: 'Share Tech Mono', monospace;
            font-size: 10px;
            color: var(--glow-blue);
            cursor: pointer;
        }

            .skill-activity-expand:hover,
            .skill-activity-expand:focus-visible {
                text-decoration: underline;
            }

        .skill-activity-full {
            font-size: 11px;
            color: var(--text-mid);
            line-height: 1.4;
            margin-top: 6px;
            word-break: break-word;
        }

        .activity-xp.xp-positive {
            color: var(--glow-gold);
        }

        .activity-xp.xp-negative {
            color: var(--glow-red);
        }

        .activity-xp.xp-zero {
            color: var(--text-dim);
        }

