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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
}

h1 {
    font-size: 38px;

    @media (max-width: 1920px) {
        font-size: 32px;
    }

    @media (max-width: 1024px) {
        font-size: 30px;
    }

    @media (max-width: 960px) {
        font-size: 24px;
    }
}

h2 {
    @media (max-width: 1024px) {
        font-size: 42px;
    }
}

.mobile-only {
    display: none;

    @media (max-width: 1024px) {
        display: block;
    }
}

.top-bar-left {
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 100;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Multi-pie tab bar */
.pie-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 0 0;
    max-width: 25vw;
}
.pie-tabs:empty,
.pie-tabs.hidden {
    display: none;
}
.pie-tab {
    padding: 4px 12px;
    border-radius: 16px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    line-height: 1.4;
}
.pie-tab.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}
.pie-tab:hover:not(.active) {
    background: #e8e8e8;
}
.pie-tab-add {
    background: transparent;
    border: 1px dashed #ccc;
    color: #999;
}
.pie-tab-add:hover {
    background: #f0f0f0;
    color: #666;
}
.pie-tab.tombstoned {
    color: #aaa;
    border-color: #ddd;
    background: transparent;
    font-style: italic;
    cursor: pointer;
}
.pie-tab.tombstoned:hover {
    background: #f5f5f5;
    color: #888;
}
.pie-tab.dragging {
    opacity: 0.4;
}
.pie-tab.drag-over {
    border-color: #4CAF50;
    box-shadow: 0 0 0 1px #4CAF50;
}

/* Pie tab context menu */
.pie-context-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    min-width: 140px;
    padding: 4px 0;
}
.pie-context-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}
.pie-context-menu button:hover {
    background: #f0f0f0;
}
.pie-context-menu button.danger {
    color: #e53935;
}
.pie-context-menu button.danger:hover {
    background: #fce4ec;
}

.top-bar-right,
.top-bar-right-mobile {
    position: absolute;
    top: 0px;
    right: 0px;
    z-index: 100;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: right;
    font-size: 18px;
}

.top-bar-right,
.top-bar-right-mobile {
    text-align: left;

    @media (max-width: 1024x) {
        flex-wrap: wrap;
    }
}

.top-bar-right {
    display: flex;

    @media (max-width: 1024px) {
        display: none;
    }
}

.top-bar-right-mobile {
    display: none;
    position: fixed;
    @media (max-width: 1024px) {
        padding: 5px;
        top: 15px;   
    }
    >div{
        gap: 15px;
    }
    
    button {
        min-height: 43px;
        @media (max-width: 1024px) {
            min-height: 23px;
            padding: 6px 20px;
        }
        @media (min-width: 1920px) {
            min-height: 48px;
        }
    }
}

@media (max-width: 1024px) {
    .top-bar-right {
        font-size: 22px;
    }

    .top-bar-right-mobile {
        display: flex;
    }
}

.main {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    scroll-snap-type: y mandatory;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    padding: 20px;
    @media (max-width: 1024px){
        padding: 55px 5px 5px 5px;
    }
    @media (max-width: 960px){
        padding: 25px 0 0 0px;
    }
    @media (max-width: 768px) {
        padding: 5px;
    }
    &#chart-outer {
        padding: 0;
        height: 100vh;
        @media (max-width: 960px) {
            height: auto;
        }
        @media (min-aspect-ratio: 169/100) {
            height: auto;
            min-height: 100vh;
        }
    }
    &#cards-outer {
    scroll-snap-align: start;
    padding: 20px;
    max-width: 100%;
    overflow: hidden;
    @media (max-width: 960px) {
        padding: 5px 15px;
    }
    }
}

#chart-outer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    overflow: hidden;
    scroll-snap-align: end;
    @media (min-aspect-ratio: 169/100) {
        overflow: visible;
    }
}

#chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 93vh;
    min-height: 700px;
    margin: 1vh 0 -1vw 0;
    width: 100%;
    max-width: 80vw;
    overflow: hidden;
    
    &.pie-view {
        transform: scale(1.1);
         @media (min-height: 1024){
            margin: 1vh 0 -1vw 0;
            transform: scale(1.16);
        }
    }
    @media (min-height: 1024) and (min-width: 1440px) {
        height: 96vh;
        margin: 6vh 0 -1vw 0;
    }

    @media (max-width: 1024px) {
        margin: 0vw 0 -8vw 0;
        min-height: 120vw;
        height: auto;
        max-width: 140vw;
    }
    @media (min-aspect-ratio: 169/100) {
        height: auto;
        min-height: 0;
        overflow: visible;
        &.pie-view {
            transform: none;
        }
    }
}


#chart-container.hide-subitem-labels:not(.tree-view) {
    transform: scale(1.3);
    transform-origin: center center;

    @media (max-width: 1024px) {
        transform: scale(1.6);
    }
}

#chart-container.hide-subitem-labels {

    .sub-item-label,
    .sub-item-line,
    .schedule-pill,
    .treemap-spoke-group {
        display: none;
    }
}

/* Treemap styles */
.treemap-category rect {
    transition: opacity 0.2s;
}

.treemap-category rect:hover {
    opacity: 0.3 !important;
}

.treemap-slice {
    font-size: 18px;
}

.treemap-slice rect {
    transition: opacity 0.2s;
}

.treemap-slice rect:hover {
    opacity: 0.95 !important;
}

.spoke-entry {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: flex-start;
}

.spoke-entry input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 18px;

    @media (max-width: 1024px) {
        font-size: 24px;
    }

}

.add-spoke-input-container input {
    font-size: 14px;

    @media (max-width: 1024px) {
        font-size: 28px;
    }
}

.spoke-entry .add-actions-btn {
    padding: 6px 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.spoke-entry .add-actions-btn:hover {
    background: #0b7dda;
}

.spoke-entry .remove-btn {
    padding: 6px 10px;
    background: #f05252;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.spoke-entry .remove-btn:hover {
    background: #da190b;
}

.actions-list {
    margin-left: 40px;
    margin-top: 5px;
    margin-bottom: 10px;
}

.action-entry {
    display: flex;
    gap: 8px;
    margin-bottom: 5px;
    align-items: center;
}

.action-entry input {
    flex: 1;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

.action-entry .remove-action-btn {
    padding: 4px 8px;
    background: #ff5722;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
}

@media (max-width: 768px) {

    #chart-container {
        min-height: 400px;
        height: 60vh;
    }

    .categories-grid {
        grid-template-columns: 1fr !important;
        overflow: hidden;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .input-group {
        width: 100%;
    }

    textarea {
        min-width: 100%;
    }

    .top-bar-left,
    .top-bar-right {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px;
    }

    .pie-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 24px;
    }
}

h1 {
    color: #333;
}

button {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;

    @media (max-width: 1024px) {
        font-size: 18px;
        padding: 20px 30px;

    }
}

button:hover {
    background: #45a049;
}

button.secondary {
    background: #2196F3;
}

button.secondary:hover {
    background: #0b7dda;
}

button.tertiary {
    background: #9C27B0;
}

button.tertiary:hover {
    background: #7B1FA2;
}

button.warn {
    background: #f05252;
}

button.warn:hover {
    background: #f04040;
}

button.blank {
    font-size: 18px;
    background: transparent;
    color: black;
    padding: 5px;
    padding: 0;
    font-weight: normal;

    @media (max-width: 1024px) {
        font-size: 16px;
    }
}

button.small {
    padding: 4px 8px;
    font-size: 14px;

    @media (max-width: 1024px) {
        font-size: 20px;
        padding: 12px 16px;
    }
}

.toggle-btn {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.toggle-btn input {
    display: none;
}

.toggle-btn span {
    padding: 6px 14px;
    border: 2px solid #2196F3;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #2196F3;
    background: transparent;
    transition: background 0.2s, color 0.2s;
    user-select: none;
    -webkit-user-select: none;
        width: 100%;
    text-align: center;
}

.toggle-btn input:checked + span {
    background: #2196F3;
    color: #fff;
}

.toggle-btn span:hover {
    background: rgba(33, 150, 243, 0.1);
}

.toggle-btn input:checked + span:hover {
    background: #1976D2;
}

.btn-label {
    @media (max-width: 960px) {
        display: none;
    }
}

input[type="file"] {
    display: none;
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;

    @media (max-width: 1024px) {
        align-items: flex-start;
    }
}

.menu-overlay.active {
    display: flex;
}

.menu-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;

    @media (max-width: 1024px) {
        padding: 20px;
        width: 96vw;
    }
}

.menu-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f05252;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.scheduler-star-btn {
    position: absolute;
    top: 15px;
    right: 52px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #e0e0e0;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s, color 0.15s;
    @media (min-width: 1920px) {
        width: 35px;
        height: 35px;
    }
}

.scheduler-star-btn.active {
    background: #FFD700;
    color: #fff;
}

.menu-section {
    margin-bottom: 30px;
}

.menu-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 20px;
}

.controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 14px;
    color: #666;
    font-weight: 500;

    @media (max-width: 1024px) {
        font-size: 18px;
    }
}

input[type="text"],
input[type="number"],
textarea,
select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 18px;
    transition: border-color 0.2s;

    @media (max-width: 1024px) {
        font-size: 24px;
    }
}

input[type="text"] {
    padding: 10px 12px;
    font-size: 18px;

    @media (max-width: 1024px) {
        font-size: 24px;
        padding: 12px 8px;
    }
}

select {
    cursor: pointer;
    min-width: 150px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4CAF50;
}

input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
}

textarea {
    min-width: 300px;
    min-height: 80px;
    font-family: inherit;
    resize: vertical;
}

.helper-text {
    font-size: 14px;
    color: #999;
    margin-top: 4px;
}

.outer-slice {
    cursor: pointer;
}

.inner-slice {
    cursor: pointer;
}

.sub-item-line {
    stroke: #888;
    stroke-width: 1;
    fill: none;
}

.category-label {
    font-size: 17px;
    font-weight: 700;
    /* fill: #333; */
    pointer-events: none;

    @media (max-width: 1024px) {
        font-size: 10px;
    }
        @media (min-width: 1440px) {
        font-size: 18.5px;
        letter-spacing: -0.1px;
    }

    @media (max-width: 768px) {
        font-size: 14px;
    }
}

.category-percentage {
    font-size: 14px;
    /* fill: #666; */
    pointer-events: none;
    display: none;
}

.item-label {
    font-size: 13px;
    font-weight: 600;
    /* fill: #333; */
    pointer-events: none;

    @media (max-width: 960px) {
        font-size: 10px;
    }
    @media (min-width: 1440px) {
        font-size: 15.5px;
        letter-spacing: -0.2px;
    }

    @media (min-width: 1920px) {
        font-size: 13px;
    }
}

.sub-item-label {
    font-size: 17px;
    letter-spacing: -0.4px;

    @media (max-width: 1024px) {
        font-size: 10px;
    }
    @media (min-width: 1440px) {
        font-size: 13.5px;
        letter-spacing: -0.1px;
    }
    @media (min-height: 1580px) {
        letter-spacing: 0.4px;
        font-size: 14px;
    }
}

.categories-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 22px;
    margin-top: 20px;

    @media (max-width: 1024px) {
        gap: 28px;
    }
}

.category-card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-left: 5px solid #4CAF50;
    max-width: 100%;
    @media (max-width: 768px) {
        padding: 5px 15px;
    }
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.category-percentage-input-container input {
    font-size: 14px;

    @media (max-width: 1024px) {
        font-size: 28px;
    }
}

.category-card h2 {
    color: #333;
    font-size: 18px;

    @media (max-width: 1024px) {
        font-size: 34px;
    }

    @media (min-width: 1920px) {
        font-size: 34px;
    }
}

.category-card .auto-percentage {
    color: #666;
    font-size: 14px;
    font-weight: 600;

    @media (max-width: 1024px) {
        font-size: 28px;
    }

    @media (min-width: 1920px) {
        font-size: 20px;
    }
}

.items-in-category {
    display: flex;
    flex-direction: column;
    gap: 16px;

    @media (max-width: 1024px) {
        gap: 22px;
    }
}

.item-card {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #2196F3;
}

.item-percentage input {
    font-size: 14px;

    @media (max-width: 1024px) {
        font-size: 28px;
    }
}

.item-card h3 {
    color: #333;
    margin-bottom: 6px;
    font-size: 14px;

    @media (max-width: 1024px) {
        font-size: 24px;
    }

    @media (min-width: 1920px) {
        font-size: 24px;
    }
}

.item-card .item-percentage {
    color: #666;
    font-size: 12px;
    margin-bottom: 10px;

    @media (max-width: 1024px) {
        margin-bottom: 12px;
        font-size: 28px;
    }
}

.item-card .spoke-list {
    list-style: none;
    padding-left: 0;
}

.item-card .spoke-list li {
    padding: 4px 0;
    color: #555;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;

    @media (max-width: 1024px) {
        padding: 6px 0;
        font-size: 24px;
    }
}

.item-card .spoke-list li .action-list {
    width: 100%;
}

.item-card .spoke-list li .action-list li {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;

    span {
        max-width: 100%;
        overflow: hidden;
    }

}

.item-card li .sub-item-text:before {
    content: none;
}

.item-card .spoke-list li .action-container {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
    background: #f5f5f5;
    border-radius: 3px;
    max-width: calc(100% - 20px);
    padding-right: 4px;
    margin-right: 20px;
}

.empty-category {
    color: #999;
    font-style: italic;
    font-size: 13px;
    padding: 10px;
}

.storage-status {
    position: fixed;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    top: 25px;
    right: 200px;

    @media (max-width: 1024px) {
        right: 260px;
        top: 35px;
    }
}

.storage-status.success {
    color: #4CAF50;
}

.storage-status.error {
    color: #f05252;
}

.info-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: #2196F3;
    color: white;
    border-radius: 50%;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    margin-left: 10px;
    font-weight: normal;
    transition: background 0.2s;

    @media (max-width: 1440px) {
        width: 18px;
        height: 18px;
        font-size: 14px;
        line-height: 18px;
    }
}

.info-icon:hover {
    background: #1976D2;
}

.disclaimer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.disclaimer-overlay.active {
    display: flex;
}

.disclaimer-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.disclaimer-content h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 24px;
}

.disclaimer-content p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 10px;
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;

    @media (max-width: 1024px) {
        align-items: flex-start;
    }
}

.settings-overlay.active {
    display: flex;
}

.settings-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;

    @media (max-width: 1024px) {
        width: 96vw;
        max-width: 96vw;
    }
}

.settings-content h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
}

.settings-section.button-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px;
}

.settings-section.settings-section-mobile {
    display: none;
    @media (max-width: 1024px) {
        display: block;
    }
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: #2196F3;
    background: #f5f9ff;
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.radio-option span {
    font-size: 16px;
    color: #333;
}

.radio-option input[type="radio"]:checked+span {
    font-weight: 600;
    color: #2196F3;
}

.datetime-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2001;

    @media (max-width: 1024px) {
        align-items: flex-start;
    }
}

.datetime-overlay.active {
    display: flex;
}

.datetime-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;

    @media (max-width: 1024px) {
        width: 96vw;
        max-width: 96vw;
    }
}

.datetime-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.datetime-section {
    margin-bottom: 20px;
}

.datetime-section label {
    display: block;
    font-size: 14px;
    color: #666;
    font-weight: 600;
    margin-bottom: 8px;
}

input[type="date"]:focus,
input[type="time"]:focus,
select:focus {
    outline: none;
    border-color: #4285F4;
}

/* Action Type Picker Overlay */
.action-type-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2004;
}

.action-type-overlay.active {
    display: flex;
}

.action-type-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 350px;
    width: 90%;
    position: relative;
}

.action-type-content h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 22px;
}

.action-type-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-type-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.action-type-btn:hover {
    border-color: #4285F4;
    background: #f5f8ff;
}

.action-type-icon {
    font-size: 24px;
}

.action-type-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.action-type-desc {
    font-size: 12px;
    color: #666;
    margin-left: auto;
}

/* Recurrence Picker Overlay */
.recurrence-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2003;
}

.recurrence-overlay.active {
    display: flex;
}

.recurrence-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.recurrence-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.recurrence-section {
    margin-bottom: 20px;
}

.recurrence-section label {
    display: block;
    font-size: 14px;
    color: #666;
    font-weight: 600;
    margin-bottom: 8px;
}

.weekday-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.weekday-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.weekday-option input[type="checkbox"] {
    display: none;
}

.weekday-option span {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e0e0;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
}

.weekday-option input[type="checkbox"]:checked+span {
    background: #4285F4;
    border-color: #4285F4;
    color: white;
}

.weekday-option:hover span {
    border-color: #4285F4;
}

.recurrence-end-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recurrence-end-options .radio-option {
    margin-bottom: 0;
}

/* Spoke Configuration Overlay */
/* Unified Spoke Editor */
.spoke-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2003;
}
.spoke-editor-overlay.active { display: flex; }

.spoke-editor-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 520px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.spoke-editor-breadcrumb {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}
.spoke-editor-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.spoke-editor-trash-btn img {
    filter: brightness(0) invert(1);
}
.spoke-editor-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    flex: 1;
}

.spoke-editor-tabs {
    display: flex;
    gap: 8px;
    margin: 16px 0 20px;
    border-bottom: 2px solid #e0e0e0;
}
.spoke-editor-tab {
    padding: 8px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #999;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.spoke-editor-tab:hover { color: #666; }
.spoke-editor-tab.active {
    color: #333;
    border-bottom-color: #4CAF50;
}

.spoke-editor-tab-content { display: none; }
.spoke-editor-tab-content.active { display: block; }

.spoke-type-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spoke-type-option {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.spoke-type-option:hover {
    border-color: #4CAF50;
    background: #f5fff5;
}

.spoke-type-option input[type="radio"]:checked~.spoke-type-label .spoke-type-title {
    color: #4CAF50;
    font-weight: 700;
}

.spoke-type-option input[type="radio"]:checked {
    accent-color: #4CAF50;
}

.spoke-type-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.spoke-type-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.spoke-type-description {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Spoke Actions List */
.spoke-actions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.spoke-action-entry {
    display: flex;
    gap: 8px;
    align-items: center;
}

.spoke-action-entry input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.spoke-action-entry input[type="text"]:focus {
    border-color: #4CAF50;
    outline: none;
}

.spoke-action-entry .remove-action-btn {
    padding: 8px 12px;
    background: #f05252;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.spoke-action-entry .remove-action-btn:hover {
    background: #d32f2f;
}

@media (max-width: 1024px) {
    .spoke-config-content {
        width: 96vw;
        max-width: 96vw;
        padding: 20px;
    }

    .spoke-type-title {
        font-size: 20px;
    }

    .spoke-type-description {
        font-size: 16px;
    }

    .spoke-action-entry input[type="text"] {
        font-size: 18px;
    }
}

/* Spoke Type Picker Overlay (simple type selection) */
.spoke-type-picker-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.spoke-type-picker-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.spoke-type-picker-btn:hover {
    border-color: #4CAF50;
    background: #f5fff5;
}

.spoke-type-picker-btn.selected {
    border-color: #4285F4;
    background: #f0f6ff;
}

.spoke-type-picker-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.spoke-type-picker-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.spoke-type-picker-desc {
    font-size: 12px;
    color: #666;
    margin-left: auto;
}

@media (max-width: 1024px) {
    .spoke-editor-content {
        width: 96vw;
        max-width: 96vw;
        padding: 20px;
    }

    .spoke-type-picker-btn {
        flex-wrap: wrap;
    }

    .spoke-type-picker-label {
        font-size: 20px;
    }

    .spoke-type-picker-desc {
        font-size: 14px;
        width: 100%;
        margin-left: 36px;
        margin-top: 4px;
    }
}

/* Menu Tabs */
.menu-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.menu-tab {
    flex: 1;
    padding: 15px 20px;
    background: #f5f5f5;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
    border-radius: 8px 8px 0 0;
}

.menu-tab:hover {
    background: #e8e8e8;
    color: #333;
}

.menu-tab.active {
    background: white;
    color: #4CAF50;
    border-bottom-color: #4CAF50;
}

.menu-tab-content {
    display: none;
}

.menu-tab-content.active {
    display: block;
}

.menu-section h3 {
    color: #333;
    font-size: 18px;
    margin-bottom: 15px;
}

.section-hint {
    color: #999;
    font-size: 13px;
    font-style: italic;
    margin-bottom: 10px;
}

.category-choice {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-option.compact {
    padding: 10px 15px;
    margin-bottom: 0;
}

.menu-nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.menu-nav-buttons button {
    min-width: 150px;
}

.menu-nav-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Category Slices List */
.category-slices-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-slices-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f9f9f9;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid #2196F3;
}

.category-slices-list li.newly-added {
    background: #e8f5e9;
    border-left-color: #4CAF50;
}

.category-slices-list li .slice-name {
    flex: 1;
    font-weight: 500;
}

.category-slices-list li .slice-percentage {
    color: #666;
    font-size: 13px;
}

.category-slices-list li .new-badge {
    background: #4CAF50;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.category-slices-list li .slice-edit-hint {
    color: #2196F3;
    font-size: 12px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s;
    margin-left: auto;
}

.category-slices-list li:hover {
    background: #e3f2fd;
}

.category-slices-list li:hover .slice-edit-hint {
    opacity: 1;
}

/* Tab 2 Header */
.tab2-header {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    flex-wrap: wrap;
}

/* Tab 2 Spokes List */
.tab2-spokes-list {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    min-height: 100px;
}

.tab2-spoke-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    border-left: 3px solid #2196F3;
}

.tab2-spoke-item:last-child {
    margin-bottom: 0;
}

.tab2-spoke-item .spoke-name {
    flex: 1;
    font-weight: 500;
}

.tab2-spoke-item .spoke-actions-count {
    color: #2196F3;
    font-weight: bold;
    font-size: 14px;
}

.tab2-spoke-item .spoke-actions-count.clickable {
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.tab2-spoke-item .spoke-actions-count.clickable:hover {
    background: #e3f2fd;
}

.tab2-spoke-item .spoke-scheduled {
    background: #4CAF50;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.tab2-spoke-item button {
    padding: 6px 12px;
    font-size: 12px;
}

.tab2-spokes-empty {
    color: #999;
    font-size: 14px;
    text-align: center;
    padding: 30px 20px;
    font-style: italic;
}

/* Expanded action list in Tab 2 */
.tab2-spoke-wrapper {
    margin-bottom: 8px;
}

.tab2-spoke-wrapper:last-child {
    margin-bottom: 0;
}

.tab2-actions-expanded {
    margin-left: 20px;
    margin-top: 8px;
    padding: 10px;
    background: #f0f7ff;
    border-radius: 6px;
    border-left: 3px solid #2196F3;
}

.tab2-action-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: white;
    border-radius: 4px;
    margin-bottom: 6px;
    font-size: 13px;
}

.tab2-action-item:last-child {
    margin-bottom: 0;
}

.tab2-action-item .action-text {
    flex: 1;
    color: #333;
}

.tab2-action-item .action-schedule {
    background: #4CAF50;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
}

.tab2-action-item button.small {
    padding: 2px 8px;
    font-size: 12px;
    margin-left: 8px;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .menu-tab {
        font-size: 16px;
        padding: 18px 15px;
    }

    .menu-section h3 {
        font-size: 22px;
    }

    .category-choice {
        flex-direction: column;
    }

    .menu-nav-buttons {
        flex-direction: column;
    }

    .menu-nav-buttons button {
        width: 100%;
    }

    .tab2-header {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ==========================================
   Cloud Sync / Firebase Styles
   ========================================== */

/* Settings page sync status */
.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 15px;
}

.sync-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sync-indicator.online {
    background: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

.sync-indicator.offline {
    background: #9e9e9e;
}

.sync-indicator.connecting {
    background: #FF9800;
    animation: pulse 1s infinite;
}

.sync-indicator.syncing {
    background: #2196F3;
    animation: pulse 0.5s infinite;
}

.sync-indicator.error {
    background: #f05252;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.sync-text {
    font-size: 14px;
    color: #666;
}

/* Main UI permanent sync indicator (in #storage-status area) */
.cloud-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cloud-sync-badge .sync-icon {
    font-size: 14px;
}

.cloud-sync-badge.synced .sync-icon {
    color: #4CAF50;
}

.cloud-sync-badge.syncing .sync-icon {
    color: #FF9800;
    animation: pulse 0.5s infinite;
}

.cloud-sync-badge.offline .sync-icon {
    color: #9e9e9e;
}

.cloud-sync-badge .sync-project {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Cloud sync section in settings */
#cloud-sync-section textarea {
    resize: vertical;
    min-height: 80px;
}

#cloud-sync-section .input-group {
    margin-bottom: 10px;
}

#firebase-auth-section {
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
}

#share-url-section {
    padding: 15px;
    background: #e8f5e9;
    border-radius: 8px;
}

/* Calendar Import Overlay */
.cal-import-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2006;
}

.cal-import-overlay.active {
    display: flex;
}

.cal-import-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

@media (max-width: 1024px) {
    .cal-import-content {
        width: 98vw;
        padding: 20px;
        max-height: 95vh;
    }
}

.cal-import-content h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 22px;
}

.cal-import-step-content {
    display: none;
}

.cal-import-step-content.active {
    display: block;
}

.cal-import-range {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.cal-import-target {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
}

.cal-import-target h3 {
    font-size: 14px;
    color: #333;
    margin: 0;
}

.cal-import-target-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.cal-import-target-row label {
    font-size: 13px;
    color: #666;
    min-width: 65px;
}

.cal-import-target-row select {
    flex: 1;
    padding: 4px 8px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.cal-import-event-list {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
}

.cal-import-event {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.cal-import-event:last-child {
    border-bottom: none;
}

.cal-import-event:hover {
    background: #f8f8f8;
}

.cal-import-event.selected {
    background: #e8f5e9;
}

.cal-import-event input[type="checkbox"] {
    flex-shrink: 0;
}

.cal-import-event-info {
    flex: 1;
    min-width: 0;
}

.cal-import-event-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cal-import-event-detail {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.cal-import-event-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    background: #e3f2fd;
    color: #1565c0;
    white-space: nowrap;
    flex-shrink: 0;
}

.cal-import-event-badge.recurring {
    background: #fff3e0;
    color: #e65100;
}

.cal-import-review {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.cal-import-review-item {
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 8px;
}

.cal-import-review-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.cal-import-review-type {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.cal-import-review-target {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.cal-import-review-target select {
    padding: 3px 6px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.cal-import-review-target button {
    font-size: 11px;
    padding: 2px 6px;
}

/* Tasks Import Styles */
.tasks-import-options {
    margin-bottom: 12px;
}

.tasks-import-options label {
    font-size: 14px;
    cursor: pointer;
}

.tasks-import-post-options label {
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.task-parsed-match {
    color: #4CAF50;
    font-weight: 600;
}

.task-parsed-new {
    color: #FF9800;
    font-weight: 600;
}

.task-parsed-spoke {
    color: #333;
}

.task-parsed-arrow {
    color: #999;
    margin: 0 4px;
}

.tasks-import-task-target {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.tasks-import-task-target select {
    font-size: 12px;
    padding: 2px 4px;
    max-width: 140px;
}

.tasks-import-task-target button {
    font-size: 11px;
    padding: 2px 6px;
}

/* Import Preview Overlay */
.import-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2005;
}

.import-overlay.active {
    display: flex;
}

.import-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

@media (max-width: 1024px) {
    .import-content {
        width: 98vw;
        padding: 20px;
        max-height: 95vh;
    }
}

.import-content h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 22px;
}

/* Import Steps */
.import-steps {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.import-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.import-step.active {
    opacity: 1;
}

.import-step.completed {
    opacity: 0.7;
}

.import-step .step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #666;
}

.import-step.active .step-number {
    background: #4CAF50;
    color: white;
}

.import-step.completed .step-number {
    background: #81C784;
    color: white;
}

.import-step .step-label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
}

.import-step.active .step-label {
    color: #4CAF50;
}

.import-step-content {
    display: none;
}

.import-step-content.active {
    display: block;
}

/* Import Tree */
.import-tree {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 350px;
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .import-tree {
        max-height: 45vh;
    }
}

.import-tree-category {
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.import-tree-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.import-tree-category-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.import-tree-category-name {
    font-weight: 600;
    flex: 1;
}

.import-tree-category-count {
    font-size: 12px;
    color: #666;
}

.import-tree-merge-badge {
    background: #FFF3E0;
    color: #E65100;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.import-tree-items {
    padding: 10px 15px;
}

.import-tree-item {
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    background: #fafafa;
    border-left: 3px solid #2196F3;
}

.import-tree-item:last-child {
    margin-bottom: 0;
}

.import-tree-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.import-tree-item-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.import-tree-item-name {
    font-weight: 500;
    flex: 1;
}

.import-tree-item-percentage {
    font-size: 11px;
    color: #666;
}

.import-tree-spokes {
    margin-top: 8px;
    padding-left: 20px;
    font-size: 13px;
    color: #666;
}

.import-tree-spoke {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.import-tree-spoke-text {
    flex: 1;
}

.import-tree-spoke-actions {
    font-size: 11px;
    color: #4285F4;
    font-weight: 500;
}

/* Import Selection Tree */
.import-tree.selectable .import-tree-category-header,
.import-tree.selectable .import-tree-item-header,
.import-tree.selectable .import-tree-spoke {
    cursor: pointer;
}

.import-tree.selectable .import-tree-category-header:hover,
.import-tree.selectable .import-tree-item-header:hover,
.import-tree.selectable .import-tree-spoke:hover {
    background: #e3f2fd;
}

.import-tree-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Apply opacity only to headers, not the whole container (so children can override) */
.import-tree-category.deselected>.import-tree-category-header,
.import-tree-item.deselected>.import-tree-item-header,
.import-tree-spoke.deselected {
    opacity: 0.4;
}

/* Ensure selected items inside deselected parents remain fully visible */
.import-tree-category.deselected .import-tree-item:not(.deselected),
.import-tree-category.deselected .import-tree-item:not(.deselected) .import-tree-item-header,
.import-tree-item.deselected .import-tree-spoke:not(.deselected) {
    opacity: 1;
}

/* Import Selection Controls */
.import-selection-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* Import Actions */
.import-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.import-actions button {
    min-width: 140px;
}

/* Import Summary */
.import-summary {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.import-summary-section {
    margin-bottom: 15px;
}

.import-summary-section:last-child {
    margin-bottom: 0;
}

.import-summary-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
}

.import-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 4px;
}

.import-summary-row.add {
    background: #e8f5e9;
    color: #2e7d32;
}

.import-summary-row.merge {
    background: #fff3e0;
    color: #e65100;
}

.import-summary-total {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: #e3f2fd;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    margin-top: 15px;
}

.import-empty-message {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

/* Export Selection Overlay */
.export-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2006;
}

.export-overlay.active {
    display: flex;
}

.export-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

@media (max-width: 1024px) {
    .export-content {
        width: 98vw;
        padding: 20px;
        max-height: 95vh;
    }
}

.export-content h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 22px;
}

.export-selection-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.export-actions-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.export-actions-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.export-summary {
    background: #f0f7ff;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #1565c0;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.export-summary-item {
    display: flex;
    gap: 5px;
}

.export-summary-count {
    font-weight: 600;
}

/* ===========================================
   TRANSFORM OVERLAY STYLES
   =========================================== */

.transform-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2006;
}

.transform-overlay.active {
    display: flex;
}

.transform-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.transform-content h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 22px;
}

.transform-step-content {
    display: none;
}

.transform-step-content.active {
    display: block;
}

.transform-source-tree {
    border: 1px solid #ddd;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.transform-tree-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.transform-tree-item:last-child {
    border-bottom: none;
}

.transform-tree-item:hover {
    background: #f5f5f5;
}

.transform-tree-item.selected {
    background: #e8f5e9;
    border-left: 3px solid #4CAF50;
}

.transform-tree-item .tree-icon {
    width: 20px;
    text-align: center;
    margin-right: 8px;
    font-size: 14px;
    flex-shrink: 0;
}

.transform-tree-item .tree-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.transform-tree-item .tree-badge {
    font-size: 12px;
    color: #999;
    margin-left: 8px;
    flex-shrink: 0;
}

.transform-tree-item .tree-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.transform-tree-item.indent-1 {
    padding-left: 32px;
}

.transform-tree-item.indent-2 {
    padding-left: 52px;
}

.transform-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.transform-option:hover {
    border-color: #aaa;
    background: #fafafa;
}

.transform-option.selected {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.transform-option .option-label {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.transform-option .option-desc {
    font-size: 13px;
    color: #666;
}

.transform-target-selector {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.transform-target-selector label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.transform-target-selector select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

.transform-preview {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.transform-preview-pane {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    padding: 15px;
    overflow-y: auto;
    max-height: 350px;
}

.transform-preview-pane h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-node {
    padding: 4px 0;
    font-size: 13px;
    color: #333;
}

.preview-node.depth-0 { padding-left: 0; }
.preview-node.depth-1 { padding-left: 20px; }
.preview-node.depth-2 { padding-left: 40px; }
.preview-node.depth-3 { padding-left: 60px; }

.preview-node .node-icon {
    display: inline-block;
    width: 18px;
    text-align: center;
    margin-right: 4px;
    font-size: 12px;
}

.preview-node .new-badge {
    display: inline-block;
    background: #4CAF50;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .transform-content {
        width: 98vw;
        padding: 20px;
        max-height: 95vh;
    }

    .transform-preview {
        flex-direction: column;
        gap: 12px;
    }

    .transform-tree-item.indent-1 {
        padding-left: 24px;
    }

    .transform-tree-item.indent-2 {
        padding-left: 40px;
    }
}

@media (max-width: 1024px) {
    .transform-content {
        width: 98vw;
        padding: 20px;
    }
}

/* ===========================================
   TUTORIAL STYLES
   =========================================== */

/* Tutorial Spotlight Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    pointer-events: none;
    display: none;
}

.tutorial-overlay.active {
    display: block;
}

.tutorial-spotlight {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75);
    border-radius: 8px;
    pointer-events: none;
    /* Allow clicks to pass through to the element underneath */
    animation: tutorial-pulse 1.5s ease-in-out infinite;
    transition: all 0.3s ease;
}

.tutorial-tooltip {
    position: absolute;
    background: white;
    padding: 20px;
    border-radius: 12px;
    max-width: 320px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    pointer-events: all;
    z-index: 3001;
}

.tutorial-tooltip h3 {
    color: #4CAF50;
    margin-bottom: 10px;
    font-size: 18px;
}

.tutorial-tooltip p {
    color: #333;
    line-height: 1.5;
    margin-bottom: 15px;
}

.tutorial-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Tutorial Modal Overlay */
.tutorial-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 3001;
    display: none;
    align-items: center;
    justify-content: center;
}

.tutorial-modal-overlay.active {
    display: flex;
}

.tutorial-modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    max-width: 420px;
    text-align: center;
    animation: tutorial-modal-appear 0.3s ease;
}

.tutorial-modal-content h2 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 24px;
}

.tutorial-modal-content p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 16px;
}

.tutorial-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Tutorial Buttons */
.tutorial-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tutorial-btn.primary {
    background: #4CAF50;
    color: white;
}

.tutorial-btn.primary:hover {
    background: #43A047;
}

.tutorial-btn.secondary {
    background: #f5f5f5;
    color: #666;
}

.tutorial-btn.secondary:hover {
    background: #e0e0e0;
}

.tutorial-skip-fixed {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10002;
    pointer-events: all;
}

/* Tutorial Animations */
@keyframes tutorial-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75), 0 0 0 4px rgba(76, 175, 80, 0.7);
    }

    50% {
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75), 0 0 0 8px rgba(76, 175, 80, 0.4);
    }
}

@keyframes tutorial-modal-appear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tutorial-tooltip {
        max-width: 280px;
        padding: 15px;
    }

    .tutorial-tooltip h3 {
        font-size: 16px;
    }

    .tutorial-tooltip p {
        font-size: 14px;
    }

    .tutorial-modal-content {
        margin: 20px;
        padding: 30px;
    }

    .tutorial-modal-content h2 {
        font-size: 20px;
    }

    .tutorial-modal-content p {
        font-size: 14px;
    }

    .tutorial-modal-buttons {
        flex-direction: column;
    }

    .tutorial-btn {
        width: 100%;
    }
}

/* Tutorial Resume Button (shown during explore mode) */
.tutorial-resume-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    z-index: 2999;
    transition: all 0.2s ease;
    display: none;
}

.tutorial-resume-btn:hover {
    background: #43A047;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.5);
}

@media (max-width: 768px) {
    .tutorial-resume-btn {
        bottom: 80px;
        right: 10px;
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* Action Checkboxes */
.action-checkbox {
    width: 16px;
    height: 16px;
    margin-right: 6px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #4CAF50;

    @media (max-width: 1024px) {
        width: 22px;
        height: 22px;
        margin-right: 8px;
    }
}

.action-completed {
    text-decoration: line-through;
    opacity: 0.5;
}

/* Prioritiser Window */
.prioritiser-window {
    display: none;
    position: fixed;
    top: 100px;
    right: 20px;
    width: 320px;
    max-height: 70vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 500;
    flex-direction: column;
    overflow: hidden;
}

.prioritiser-window.active {
    display: flex;
}

.prioritiser-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 12px 12px 0 0;
}

.prioritiser-title {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.prioritiser-close {
    background: none;
    border: none;
    font-size: 16px;
    color: #999;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.prioritiser-close:hover {
    background: #e0e0e0;
    color: #333;
}

.prioritiser-body {
    padding: 8px 0;
    overflow-y: auto;
    flex: 1;
}

.prioritiser-list {
    display: flex;
    flex-direction: column;
}

.prioritiser-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    cursor: grab;
    transition: background 0.15s;
}

.prioritiser-item:hover {
    background: #f5f5f5;
}

.prioritiser-item.dragging {
    opacity: 0.4;
}

.prioritiser-item.drag-over {
    border-top: 2px solid #4285F4;
}

.priority-rank {
    font-size: 11px;
    font-weight: bold;
    color: #999;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.priority-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.priority-name {
    font-size: 13px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.priority-context {
    font-size: 10px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.priority-remove {
    background: none;
    border: none;
    font-size: 14px;
    color: #ccc;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 1;
}

.priority-remove:hover {
    color: #f05252;
    background: #ffeaea;
}

.prioritiser-empty {
    padding: 16px 14px;
    color: #999;
    font-size: 12px;
    text-align: center;
}

.prioritiser-show-all {
    padding: 6px 14px;
    text-align: center;
}

.priority-star-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: #ccc;
    padding: 2px 4px;
    line-height: 1.2;
    transition: color 0.15s;
    @media (max-width: 1024px) {
        font-size: 20px;
    }
}

.priority-star-btn:hover {
    color: #FFD700;
}

.priority-star-btn.active {
    color: #FFD700;
}

@media (max-width: 768px) {
    .prioritiser-window {
        width: 280px;
        right: 10px;
        top: 80px;
        max-height: 60vh;
    }
}

/* Documentation Overlay */
.docs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.docs-overlay.active {
    display: flex;
}

.docs-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.docs-content h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 24px;
}

.docs-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 15px;
}

.docs-nav-btn {
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    color: #666;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.docs-nav-btn.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.docs-nav-btn:hover:not(.active) {
    background: #e8e8e8;
}

.docs-page {
    display: none;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.docs-page.active {
    display: block;
}

.docs-page h3 {
    color: #333;
    margin: 20px 0 10px;
}

.docs-page h3:first-child {
    margin-top: 0;
}

.docs-page p {
    color: #555;
    line-height: 1.6;
    margin-bottom: 10px;
}

.docs-page ul {
    color: #555;
    line-height: 1.8;
    margin-left: 20px;
    margin-bottom: 15px;
}

.docs-page table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.docs-page th,
.docs-page td {
    padding: 8px 12px;
    border: 1px solid #ddd;
    text-align: left;
    font-size: 14px;
}

.docs-page th {
    background: #f5f5f5;
    font-weight: 600;
}

.docs-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .docs-content {
        padding: 20px;
        max-height: 90vh;
    }

    .docs-nav {
        gap: 6px;
    }

    .docs-nav-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
}