        @import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

        :root {
            --bg: #EEF1F6;
            --ink: #1F2544;
            --ink-soft: #545B75;
            --card-border: #E4E8F1;
            --accent: #3B82F6;
            --danger: #FF6B6B;
            --shadow: 0 2px 10px rgba(31, 37, 68, 0.08), 0 1px 2px rgba(31, 37, 68, 0.06);
            --shadow-lift: 0 10px 24px rgba(31, 37, 68, 0.16), 0 2px 6px rgba(31, 37, 68, 0.08);
            --root-color: #1F2544;
            --sidebar-width: 56px;
            --sidebar-expanded: 260px;
            --canvas-bg: #EEF1F6;
            --grid-dot: #D7DDE8;
            --panel-bg: #fff;
            --panel-header-bg: #FAFBFD;
            --input-bg: #FAFBFD;
            --input-border: #E4E8F1;
            --context-bg: #fff;
            --context-hover: #F5F7FB;
            --modal-overlay: rgba(0, 0, 0, 0.4);
            --swatch-border: rgba(0, 0, 0, 0.08);
            --tooltip-bg: #fff;
        }

        [data-theme="dark"] {
            --bg: #1A1C2E;
            --ink: #E8EDF5;
            --ink-soft: #A0A9C5;
            --card-border: #2E324C;
            --accent: #6B9BFF;
            --danger: #FF7A7A;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
            --shadow-lift: 0 10px 24px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
            --root-color: #6B9BFF;
            --canvas-bg: #141625;
            --grid-dot: #2A2E4A;
            --panel-bg: #1E213A;
            --panel-header-bg: #252949;
            --input-bg: #252949;
            --input-border: #3A3F62;
            --context-bg: #1E213A;
            --context-hover: #2A2F50;
            --modal-overlay: rgba(0, 0, 0, 0.7);
            --swatch-border: rgba(255, 255, 255, 0.1);
            --tooltip-bg: #1E213A;
        }

        /* ===== SHARED STUDYBRO NAVIGATION THEME ===== */
        :root {
            --bg: #111111;
            --ink: #F3F3F3;
            --ink-soft: #A5A5A5;
            --card-border: #303030;
            --accent: #E85D04;
            --root-color: #E85D04;
            --canvas-bg: #171717;
            --grid-dot: #303030;
            --panel-bg: #1B1B1B;
            --panel-header-bg: #202020;
            --input-bg: #191919;
            --input-border: #3A3A3A;
            --context-bg: #1B1B1B;
            --context-hover: #2A2A2A;
            --tooltip-bg: #1B1B1B;
            --app-nav-width: 232px;
        }

        [data-theme="dark"] {
            --bg: #111111;
            --ink: #F3F3F3;
            --ink-soft: #A5A5A5;
            --card-border: #303030;
            --accent: #FF7518;
            --root-color: #FF7518;
            --canvas-bg: #171717;
            --grid-dot: #303030;
            --panel-bg: #1B1B1B;
            --panel-header-bg: #202020;
            --input-bg: #191919;
            --input-border: #3A3A3A;
            --context-bg: #1B1B1B;
            --context-hover: #2A2A2A;
            --tooltip-bg: #1B1B1B;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: var(--bg);
            overflow: hidden;
            color: var(--ink);
            transition: background 0.25s ease, color 0.25s ease;
        }

        .app-topbar {
            height: 44px;
            display: flex;
            align-items: center;
            gap: 4px;
            padding: 0 10px;
            background: var(--panel-header-bg);
            border-bottom: 1px solid var(--card-border);
            flex-shrink: 0;
            margin-left: var(--app-nav-width);
            transition: margin-left 0.25s ease;
        }

        .app-tab-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 7px 16px;
            border-radius: 8px 8px 0 0;
            border: none;
            background: transparent;
            color: var(--ink-soft);
            font-size: 13.5px;
            font-weight: 600;
            cursor: pointer;
            text-decoration: none;
            transition: background 0.15s ease, color 0.15s ease;
        }

        .app-tab-btn:hover {
            background: rgba(59, 130, 246, 0.08);
        }

        .app-tab-btn.active {
            background: var(--bg);
            color: #FF7518;
            box-shadow: inset 0 -2px 0 #E85D04;
        }

        .container {
            display: flex;
            height: calc(100vh - 44px);
            margin-left: var(--app-nav-width);
            transition: margin-left 0.25s ease;
        }

        .app-tab-btn:hover {
            background: rgba(232, 93, 4, 0.12);
        }

        .app-nav-sidebar {
            position: fixed;
            z-index: 1000;
            top: 0;
            right: auto;
            left: 0;
            bottom: 0;
            left: 0;
            width: var(--app-nav-width);
            padding: 18px 14px;
            overflow: hidden;
            background: #151515;
            border-right: 1px solid #303030;
            transition: width 0.25s ease;
        }

        .app-nav-brand {
            display: flex;
            align-items: center;
            gap: 10px;
            height: 38px;
            padding: 0 10px;
            color: #F3F3F3;
            font-family: 'Sora', sans-serif;
            white-space: nowrap;
        }

        .app-nav-brand-toggle {
            width: 100%;
            border: 0;
            background: transparent;
            cursor: pointer;
            text-align: left;
        }

        .hodi-logo {
            display: grid;
            width: 28px;
            height: 28px;
            flex-shrink: 0;
            place-items: center;
            border-radius: 7px;
            background: #E85D04;
        }

        .hodi-logo svg {
            width: 21px;
            height: 21px;
            fill: none;
            stroke: #fff;
            stroke-linecap: round;
            stroke-linejoin: round;
            stroke-width: 1.8;
        }

        .app-nav-brand span {
            display: grid;
            width: 28px;
            height: 28px;
            place-items: center;
            border-radius: 7px;
            background: #E85D04;
            color: #fff;
        }

        .app-nav-brand .hodi-mark {
            position: relative;
            color: #fff;
            font-family: 'Sora', sans-serif;
            font-size: 0;
            font-weight: 700;
            line-height: 1;
        }

        .app-nav-brand .hodi-mark::before,
        .app-nav-brand .hodi-mark::after {
            position: absolute;
            top: 8px;
            width: 8px;
            height: 11px;
            border: 2px solid #fff;
            content: '';
        }

        .app-nav-brand .hodi-mark::before {
            left: 5px;
            border-right-width: 1px;
            border-radius: 3px 0 0 3px;
            transform: skewY(-9deg);
        }

        .app-nav-brand .hodi-mark::after {
            right: 5px;
            border-left-width: 1px;
            border-radius: 0 3px 3px 0;
            transform: skewY(9deg);
        }

        .app-nav-toggle {
            position: absolute;
            top: 22px;
            right: 12px;
            width: 25px;
            height: 25px;
            border: 1px solid #3A3A3A;
            border-radius: 5px;
            background: #202020;
            color: #A5A5A5;
            cursor: pointer;
            font-size: 18px;
            line-height: 1;
        }

        .app-nav-toggle:hover {
            border-color: #E85D04;
            color: #FF7518;
        }

        .app-nav-links {
            display: grid;
            gap: 6px;
            margin-top: 28px;
        }

        .app-nav-link {
            display: flex;
            align-items: center;
            gap: 13px;
            min-height: 44px;
            padding: 0 12px;
            border-radius: 7px;
            color: #A5A5A5;
            font-size: 14px;
            text-decoration: none;
            white-space: nowrap;
        }

        .app-nav-link span {
            width: 22px;
            text-align: center;
            font-size: 18px;
        }

        .mindmap-icon {
            width: 21px;
            height: 21px;
            fill: none;
            stroke: var(--accent);
            stroke-linecap: round;
            stroke-linejoin: round;
            stroke-width: 1.8;
        }

        .flashcard-icon {
            width: 21px;
            height: 21px;
            fill: none;
            stroke: var(--accent);
            stroke-linecap: round;
            stroke-linejoin: round;
            stroke-width: 1.8;
        }

        .app-nav-link .mindmap-icon,
        .app-tab-btn .mindmap-icon,
        .sidebar-header .mindmap-icon,
        .app-nav-link .flashcard-icon,
        .app-tab-btn .flashcard-icon,
        .sidebar-header .flashcard-icon {
            display: block;
            flex-shrink: 0;
        }

        .app-nav-link:hover,
        .app-nav-link.active {
            background: rgba(232, 93, 4, 0.16);
            color: #F3F3F3;
        }

        .app-nav-link.active {
            box-shadow: inset 3px 0 0 #E85D04;
        }

        body.app-nav-collapsed {
            --app-nav-width: 64px;
        }

        body.app-nav-collapsed .app-nav-sidebar {
            padding-right: 10px;
            padding-left: 10px;
        }

        body.app-nav-collapsed .app-nav-brand b,
        body.app-nav-collapsed .app-nav-link b {
            display: none;
        }

        body.app-nav-collapsed .app-nav-brand,
        body.app-nav-collapsed .app-nav-link {
            justify-content: center;
            padding-right: 0;
            padding-left: 0;
        }

        body.app-nav-collapsed .app-nav-toggle {
            right: 19px;
        }

        /* ===== SIDEBAR ===== */
        .sidebar {
            width: var(--sidebar-width);
            background: var(--panel-bg);
            border-right: 1px solid var(--card-border);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            flex-shrink: 0;
            transition: width 0.25s ease, background 0.25s ease, border-color 0.25s ease;
            position: relative;
            z-index: 200;
        }

        .sidebar.expanded {
            width: var(--sidebar-expanded);
        }

        .sidebar-header {
            padding: 8px 6px;
            border-bottom: 1px solid var(--card-border);
            background: var(--panel-header-bg);
            display: flex;
            align-items: center;
            justify-content: space-between;
            min-height: 48px;
            transition: background 0.25s ease, border-color 0.25s ease;
        }

        .sidebar-header .logo-area {
            display: flex;
            align-items: center;
            gap: 6px;
            overflow: hidden;
        }

        .sidebar-header .logo-icon {
            font-size: 20px;
            cursor: pointer;
            flex-shrink: 0;
            transition: transform 0.2s ease;
        }
        .sidebar-header .logo-icon:hover {
            transform: scale(1.1);
        }

        .sidebar-header .logo-text {
            font-family: 'Sora', sans-serif;
            font-size: 15px;
            font-weight: 800;
            color: var(--ink);
            white-space: nowrap;
            opacity: 0;
            transition: opacity 0.2s ease;
        }
        .sidebar.expanded .sidebar-header .logo-text {
            opacity: 1;
        }

        .sidebar-close-btn {
            width: 28px;
            height: 28px;
            border: none;
            background: transparent;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;
            color: var(--ink-soft);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s ease;
            flex-shrink: 0;
            opacity: 0;
            pointer-events: none;
        }
        .sidebar.expanded .sidebar-close-btn {
            opacity: 1;
            pointer-events: auto;
        }
        .sidebar-close-btn:hover {
            background: #FDECEC;
            color: #C22;
        }
        [data-theme="dark"] .sidebar-close-btn:hover {
            background: #3A1F2A;
            color: #FF7A7A;
        }

        .sidebar-body {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        .sidebar-icons {
            width: var(--sidebar-width);
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            padding: 6px 4px;
            gap: 2px;
            overflow-y: auto;
            background: var(--panel-header-bg);
        }

        .sidebar-icon-btn {
            width: 44px;
            height: 44px;
            border: none;
            background: transparent;
            border-radius: 10px;
            cursor: pointer;
            font-size: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s ease;
            color: var(--ink-soft);
            position: relative;
        }

        .sidebar-icon-btn:hover {
            background: var(--context-hover);
            color: var(--ink);
        }
        .sidebar-icon-btn.active {
            background: var(--root-color);
            color: #fff;
        }

        .sidebar-icon-btn .tooltip {
            position: absolute;
            left: 52px;
            top: 50%;
            transform: translateY(-50%);
            background: var(--root-color);
            color: #fff;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 11px;
            font-weight: 500;
            font-family: 'Inter', sans-serif;
            white-space: nowrap;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.15s ease;
        }
        .sidebar-icon-btn:hover .tooltip {
            opacity: 1;
        }

        .sidebar-content {
            flex: 1;
            overflow-y: auto;
            padding: 8px 12px;
            display: none;
            background: var(--panel-bg);
            transition: background 0.25s ease;
        }

        .sidebar.expanded .sidebar-content {
            display: block;
        }

        .sidebar-content .section-title {
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--ink-soft);
            margin: 10px 0 6px;
        }
        .sidebar-content .section-title:first-child {
            margin-top: 0;
        }

        .sidebar-content textarea {
            width: 100%;
            padding: 7px 8px;
            border: 1px solid var(--input-border);
            border-radius: 8px;
            font-size: 12px;
            resize: vertical;
            margin-bottom: 6px;
            font-family: 'Inter', sans-serif;
            background: var(--input-bg);
            color: var(--ink);
            min-height: 120px;
            transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
        }
        .sidebar-content textarea:focus {
            outline: none;
            border-color: var(--accent);
            background: var(--panel-bg);
        }

        .sidebar-content .action-btn {
            width: 100%;
            padding: 7px;
            margin-bottom: 4px;
            border: 1px solid var(--input-border);
            background: var(--panel-bg);
            border-radius: 8px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
            font-family: 'Inter', sans-serif;
            color: var(--ink);
            transition: all 0.15s ease;
            text-align: center;
        }
        .sidebar-content .action-btn:hover {
            background: var(--context-hover);
            border-color: var(--accent);
            transform: translateY(-1px);
        }
        .sidebar-content .action-btn.primary {
            background: var(--root-color);
            color: #fff;
            border-color: var(--root-color);
        }
        .sidebar-content .action-btn.primary:hover {
            background: #4a6fcf;
        }
        [data-theme="dark"] .sidebar-content .action-btn.primary:hover {
            background: #5a8aff;
        }

        /* ===== CANVAS ===== */
        .canvas-area {
            flex: 1;
            position: relative;
            overflow: hidden;
            background: var(--canvas-bg);
            transition: background 0.25s ease;
        }

        canvas {
            display: block;
            cursor: grab;
        }
        canvas.grabbing {
            cursor: grabbing;
        }

        .controls {
            position: absolute;
            top: 14px;
            right: 14px;
            display: flex;
            gap: 6px;
            background: var(--panel-bg);
            padding: 6px;
            border-radius: 12px;
            border: 1px solid var(--card-border);
            box-shadow: var(--shadow);
            z-index: 100;
            flex-wrap: wrap;
            max-width: 300px;
            transition: background 0.25s ease, border-color 0.25s ease;
        }

        .control-btn {
            min-width: 32px;
            height: 32px;
            border: 1px solid var(--card-border);
            background: var(--panel-bg);
            border-radius: 9px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            font-weight: bold;
            color: var(--ink);
            transition: all 0.15s ease;
            padding: 0 8px;
            font-family: 'Inter', sans-serif;
        }
        .control-btn:hover {
            background: var(--context-hover);
            border-color: var(--accent);
            transform: translateY(-1px);
        }
        .control-btn.active {
            background: var(--accent);
            color: #fff;
            border-color: var(--accent);
        }
        .control-btn.create-node-btn {
            background: var(--root-color);
            border-color: var(--root-color);
            color: #fff;
        }
        .control-btn.create-node-btn:hover {
            background: #4a6fcf;
            border-color: #4a6fcf;
        }
        .canvas-node-hint {
            position: absolute;
            left: 18px;
            bottom: 18px;
            z-index: 50;
            max-width: 290px;
            padding: 9px 12px;
            border: 1px solid var(--card-border);
            border-radius: 10px;
            background: color-mix(in srgb, var(--panel-bg) 92%, transparent);
            color: var(--ink-soft);
            font-size: 12px;
            box-shadow: var(--shadow);
            pointer-events: none;
        }
        .text-to-mindmap-guide {
            margin: 0 0 10px;
            padding: 10px;
            border: 1px solid var(--card-border);
            border-radius: 10px;
            background: var(--context-hover);
            color: var(--ink-soft);
            font-size: 11px;
            line-height: 1.45;
        }
        .text-to-mindmap-guide strong { color: var(--ink); }
        .text-to-mindmap-guide ol { margin: 5px 0 7px 18px; padding: 0; }
        .text-to-mindmap-guide pre {
            margin: 0;
            padding: 7px;
            overflow-x: auto;
            border-radius: 6px;
            background: var(--panel-bg);
            color: var(--ink);
            font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
        }

        .zoom-display {
            font-size: 11px;
            font-weight: 600;
            padding: 4px 8px;
            border: 1px solid var(--card-border);
            border-radius: 9px;
            background: var(--panel-bg);
            min-width: 40px;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--ink-soft);
            transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
        }

        .selection-box {
            position: absolute;
            border: 1.5px dashed var(--accent);
                background: rgba(232, 93, 4, 0.12);
            pointer-events: none;
            z-index: 60;
            display: none;
        }

        .node-tooltip {
            position: fixed;
            background: var(--tooltip-bg);
            border: 1px solid var(--card-border);
            border-radius: 12px;
            padding: 8px;
            box-shadow: var(--shadow-lift);
            z-index: 2000;
            pointer-events: none;
            display: none;
            max-width: 300px;
            transition: background 0.25s ease, border-color 0.25s ease;
        }
        .node-tooltip img {
            max-width: 280px;
            max-height: 200px;
            border-radius: 8px;
            display: block;
        }
        .node-tooltip .tooltip-text {
            font-size: 12px;
            color: var(--ink-soft);
            margin-top: 4px;
            text-align: center;
        }

        .context-menu {
            position: fixed;
            background: var(--context-bg);
            border: 1px solid var(--card-border);
            border-radius: 12px;
            padding: 6px;
            box-shadow: var(--shadow-lift);
            z-index: 2000;
            min-width: 200px;
            transition: background 0.25s ease, border-color 0.25s ease;
        }
        .context-menu-item {
            padding: 7px 14px;
            cursor: pointer;
            border-radius: 6px;
            font-size: 12.5px;
            font-weight: 500;
            font-family: 'Inter', sans-serif;
            color: var(--ink);
            transition: background 0.1s ease;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .context-menu-item:hover {
            background: var(--context-hover);
        }
        .context-menu-item.danger {
            color: var(--danger);
        }
        .context-menu-item.danger:hover {
            background: rgba(255, 107, 107, 0.15);
        }
        .context-menu-divider {
            height: 1px;
            background: var(--card-border);
            margin: 4px 8px;
            transition: background 0.25s ease;
        }
        .context-menu-sub {
            position: relative;
        }
        .context-menu-sub .sub-menu {
            display: none;
            position: absolute;
            left: 100%;
            top: -6px;
            background: var(--context-bg);
            border: 1px solid var(--card-border);
            border-radius: 12px;
            padding: 6px;
            box-shadow: var(--shadow-lift);
            min-width: 140px;
            transition: background 0.25s ease, border-color 0.25s ease;
        }
        .context-menu-sub:hover .sub-menu {
            display: block;
        }
        .context-menu-sub .sub-menu .context-menu-item {
            padding: 6px 14px;
            font-size: 12px;
        }

        #right-panel {
            box-shadow: -6px 0 18px rgba(31, 37, 68, 0.06);
            flex-shrink: 0;
            background: var(--panel-bg);
            border-left: 1px solid var(--card-border);
            transition: width 0.25s ease, background 0.25s ease, border-color 0.25s ease;
        }
        .rp-header {
            padding: 14px;
            border-bottom: 1px solid var(--card-border);
            background: var(--panel-header-bg);
            position: relative;
            display: flex;
            align-items: center;
            justify-content: space-between;
            transition: background 0.25s ease, border-color 0.25s ease;
        }
        .rp-header h3 {
            font-family: 'Sora', sans-serif;
            font-size: 14px;
            font-weight: 800;
            margin: 0;
            color: var(--ink);
        }
        .rp-close {
            background: var(--panel-bg);
            border: 1px solid var(--card-border);
            border-radius: 50%;
            cursor: pointer;
            font-size: 14px;
            width: 26px;
            height: 26px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--ink-soft);
            transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
        }
        .rp-close:hover {
            background: #FDECEC;
            color: #C22;
            border-color: #F7C9C9;
        }
        [data-theme="dark"] .rp-close:hover {
            background: #3A1F2A;
            color: #FF7A7A;
            border-color: #5A2A3A;
        }
        .rp-body {
            flex: 1;
            overflow-y: auto;
            padding: 14px;
            min-width: 300px;
            background: var(--panel-bg);
            transition: background 0.25s ease;
        }

        .field-label {
            font-size: 10px;
            color: var(--ink-soft);
            display: block;
            margin-bottom: 4px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: .02em;
            transition: color 0.25s ease;
        }
        .field-block {
            margin-bottom: 12px;
        }
        .swatch-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 5px;
        }
        .swatch {
            width: 100%;
            aspect-ratio: 1;
            border-radius: 8px;
            cursor: pointer;
            transition: transform .1s ease;
            border: 1px solid var(--swatch-border);
        }
        .swatch:hover {
            transform: scale(1.08);
        }
        .swatch.selected {
            border: 3px solid var(--accent);
        }

        .rp-primary-btn {
            width: 100%;
            padding: 10px;
            background: var(--root-color);
            color: #fff;
            border: none;
            border-radius: 9px;
            cursor: pointer;
            font-weight: 700;
            font-family: 'Inter', sans-serif;
            font-size: 12.5px;
            margin-bottom: 6px;
            transition: background .15s ease;
        }
        .rp-primary-btn:hover {
            background: #4a6fcf;
        }
        [data-theme="dark"] .rp-primary-btn:hover {
            background: #5a8aff;
        }
        .rp-danger-btn {
            width: 100%;
            padding: 10px;
            background: var(--panel-bg);
            color: var(--danger);
            border: 1px solid var(--card-border);
            border-radius: 9px;
            cursor: pointer;
            font-weight: 700;
            font-family: 'Inter', sans-serif;
            font-size: 12.5px;
            transition: background 0.25s ease, border-color 0.25s ease;
        }
        .rp-danger-btn:hover {
            background: rgba(255, 107, 107, 0.12);
        }
        .two-col {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }
        .hint-text {
            font-size: 11.5px;
            color: var(--ink-soft);
            line-height: 1.5;
            background: var(--input-bg);
            border: 1px dashed var(--card-border);
            border-radius: 8px;
            padding: 8px 10px;
            transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
        }
        .rp-textarea {
            resize: vertical;
            min-height: 60px;
            width: 100%;
            padding: 7px 8px;
            border: 1px solid var(--input-border);
            border-radius: 8px;
            font-size: 12px;
            font-family: 'Inter', sans-serif;
            background: var(--input-bg);
            color: var(--ink);
            transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
        }
        .rp-textarea:focus {
            outline: none;
            border-color: var(--accent);
            background: var(--panel-bg);
        }
        .rp-text-input {
            width: 100%;
            padding: 7px 8px;
            border: 1px solid var(--input-border);
            border-radius: 8px;
            font-size: 12px;
            font-family: 'Inter', sans-serif;
            background: var(--input-bg);
            color: var(--ink);
            transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
        }
        .rp-text-input:focus {
            outline: none;
            border-color: var(--accent);
            background: var(--panel-bg);
        }
        .rp-text-input[type="color"] {
            padding: 0;
            height: 32px;
            cursor: pointer;
        }

        .text-style-group {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
            margin-top: 4px;
        }
        .text-style-btn {
            padding: 5px 10px;
            border: 1px solid var(--card-border);
            background: var(--panel-bg);
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            font-family: 'Inter', sans-serif;
            color: var(--ink);
            transition: all 0.15s ease;
            min-width: 32px;
            text-align: center;
        }
        .text-style-btn:hover {
            background: var(--context-hover);
            border-color: var(--accent);
        }
        .text-style-btn.active {
            background: var(--root-color);
            color: #fff;
            border-color: var(--root-color);
        }
        .text-style-btn.color-red {
            color: #EF4444;
            background: #FEF2F2;
        }
        [data-theme="dark"] .text-style-btn.color-red {
            background: #3A1F2A;
        }
        .text-style-btn.color-red.active {
            background: #EF4444;
            color: #fff;
        }
        .text-style-btn.color-black {
            color: #1F2544;
            background: #F5F7FB;
        }
        [data-theme="dark"] .text-style-btn.color-black {
            color: #E8EDF5;
            background: #2A2F50;
        }
        .text-style-btn.color-black.active {
            background: #1F2544;
            color: #fff;
        }
        [data-theme="dark"] .text-style-btn.color-black.active {
            background: #E8EDF5;
            color: #1F2544;
        }
        .text-style-btn.color-white {
            color: #1F2544;
            background: #EEEEEE;
        }
        [data-theme="dark"] .text-style-btn.color-white {
            color: #E8EDF5;
            background: #3A3F62;
        }
        .text-style-btn.color-white.active {
            background: #1F2544;
            color: #fff;
        }
        [data-theme="dark"] .text-style-btn.color-white.active {
            background: #E8EDF5;
            color: #1F2544;
        }
        .text-style-btn.color-blue {
            color: #2563EB;
            background: #EFF6FF;
        }
        [data-theme="dark"] .text-style-btn.color-blue {
            background: #1A2A4A;
        }
        .text-style-btn.color-blue.active {
            background: #2563EB;
            color: #fff;
        }

        .selection-count {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--root-color);
            color: #fff;
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            font-family: 'Inter', sans-serif;
            box-shadow: var(--shadow-lift);
            z-index: 80;
            display: none;
            pointer-events: none;
        }

        .inline-edit {
            position: fixed;
            z-index: 1000;
            background: var(--panel-bg);
            border: 2px solid var(--accent);
            border-radius: 8px;
            padding: 4px 10px;
            font-family: 'Inter', sans-serif;
            font-size: 13px;
            color: var(--ink);
            box-shadow: var(--shadow-lift);
            outline: none;
            min-width: 30px;
            text-align: center;
            transition: background 0.25s ease, color 0.25s ease;
        }
        .inline-edit:focus {
            outline: none;
            border-color: var(--accent);
        }

        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--modal-overlay);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 3000;
            backdrop-filter: blur(3px);
            transition: background 0.25s ease;
        }
        .modal-box {
            background: var(--panel-bg);
            border-radius: 16px;
            padding: 28px 32px 24px;
            box-shadow: var(--shadow-lift);
            min-width: 380px;
            max-width: 460px;
            transition: background 0.25s ease;
        }
        .modal-box h3 {
            font-family: 'Sora', sans-serif;
            font-size: 16px;
            font-weight: 800;
            color: var(--ink);
            margin-bottom: 8px;
        }
        .modal-box p {
            font-size: 13px;
            color: var(--ink-soft);
            margin-bottom: 16px;
        }
        .modal-box input[type="text"] {
            width: 100%;
            padding: 10px 12px;
            border: 1.5px solid var(--input-border);
            border-radius: 10px;
            font-size: 14px;
            font-family: 'Inter', sans-serif;
            background: var(--input-bg);
            color: var(--ink);
            margin-bottom: 16px;
            transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
        }
        .modal-box input[type="text"]:focus {
            outline: none;
            border-color: var(--accent);
            background: var(--panel-bg);
        }
        .modal-actions {
            display: flex;
            gap: 10px;
            justify-content: flex-end;
        }
        .modal-actions button {
            padding: 9px 24px;
            border: 1px solid var(--card-border);
            border-radius: 10px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            font-family: 'Inter', sans-serif;
            transition: all 0.15s ease;
            background: var(--panel-bg);
            color: var(--ink);
        }
        .modal-actions .btn-cancel:hover {
            background: var(--context-hover);
        }
        .modal-actions .btn-confirm {
            background: var(--root-color);
            color: #fff;
            border-color: var(--root-color);
        }
        .modal-actions .btn-confirm:hover {
            background: #4a6fcf;
            transform: translateY(-1px);
        }
        [data-theme="dark"] .modal-actions .btn-confirm:hover {
            background: #5a8aff;
        }

        .snipping-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.3);
            z-index: 5000;
            cursor: crosshair;
        }
        .snipping-box {
            position: absolute;
            border: 2px solid var(--accent);
            background: rgba(232, 93, 4, 0.14);
            pointer-events: none;
        }
        .snipping-info {
            position: fixed;
            bottom: 30px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--root-color);
            color: #fff;
            padding: 10px 20px;
            border-radius: 12px;
            font-size: 13px;
            font-weight: 500;
            font-family: 'Inter', sans-serif;
            z-index: 5001;
            box-shadow: var(--shadow-lift);
        }

        .lang-toggle-sidebar {
            display: flex;
            gap: 4px;
            margin-top: 8px;
        }
        .lang-toggle-sidebar .lang-btn {
            flex: 1;
            padding: 5px;
            border: 1px solid var(--card-border);
            background: var(--panel-bg);
            border-radius: 6px;
            cursor: pointer;
            font-size: 11px;
            font-weight: 600;
            font-family: 'Inter', sans-serif;
            color: var(--ink-soft);
            transition: all 0.15s ease;
            text-align: center;
        }
        .lang-toggle-sidebar .lang-btn:hover {
            background: var(--context-hover);
        }
        .lang-toggle-sidebar .lang-btn.active {
            background: var(--root-color);
            color: #fff;
            border-color: var(--root-color);
        }

        .theme-toggle-row {
            display: flex;
            gap: 6px;
            margin-top: 8px;
            align-items: center;
        }
        .theme-toggle-row .theme-btn {
            flex: 1;
            padding: 6px 10px;
            border: 1px solid var(--card-border);
            background: var(--panel-bg);
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
            font-family: 'Inter', sans-serif;
            color: var(--ink-soft);
            transition: all 0.15s ease;
            text-align: center;
        }
        .theme-toggle-row .theme-btn:hover {
            background: var(--context-hover);
        }
        .theme-toggle-row .theme-btn.active {
            background: var(--root-color);
            color: #fff;
            border-color: var(--root-color);
        }

        ::-webkit-scrollbar {
            width: 4px;
        }
        ::-webkit-scrollbar-track {
            background: transparent;
        }
        ::-webkit-scrollbar-thumb {
            background: var(--card-border);
            border-radius: 4px;
            transition: background 0.25s ease;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--ink-soft);
        }

        @media (max-width: 720px) {
            :root {
                --app-nav-width: 64px;
            }

            .app-nav-sidebar {
                padding-right: 10px;
                padding-left: 10px;
            }

            .app-nav-brand b,
            .app-nav-link b {
                display: none;
            }

            .app-nav-brand,
            .app-nav-link {
                justify-content: center;
                padding-right: 0;
                padding-left: 0;
            }

            .app-nav-toggle {
                right: 19px;
            }
        }
