body {
    font-family: Arial, sans-serif;
    padding: 20px;
    background: #f5f0ff;
    color: #333;
    overflow-x: hidden;
    position: relative;
}

#groupList {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

#shoppingLists {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.listTotal,
.overallTotal {
    margin-top: 5px;
    font-weight: bold;
}

.overallTotal {
    width: 100%;
}

.group {
    border: 2px solid #000;
    padding: 10px;
    background: #f0e6ff;
    border-radius: 6px;
    width: 260px;
    flex-shrink: 0;
}

.shopList {
    border: 2px solid #000;
    padding: 10px;
    background: #e6f7ff;
    border-radius: 6px;
    width: 260px;
    flex-shrink: 0;
}
.shopList li {
    list-style: none;
    padding: 4px 0;
    border-bottom: 1px solid #ccc;
}
.shopList h3 {
    margin: 0 0 5px 0;
}

.chartTooltip {
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: pre;
    transform: translate(-50%, -100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.group h2 {
    margin: 0 0 5px 0;
    position: relative;
}

.infoBtn {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.8em;
    padding: 2px 4px;
}

.group.pinned {
    background: #e0d4ff;
}

.xpWrapper {
    margin-top: 4px;
}

.xpBar {
    width: 100%;
    height: 8px;
    background: #ddd;
    border: 1px solid #000;
}

.xpFill {
    height: 100%;
    background: #c55fff;
}

.levelLabel {
    font-size: 0.9em;
    color: #333;
    margin-top: 2px;
}

.sendTelegram {
    margin: 5px 0;
}

button {
    margin-right: 5px;
    background: #c55fff;
    color: #fff;
    border: 1px solid #000;
    border-radius: 4px;
    cursor: pointer;
}

.pell-button {
    color: #000;
}
button:hover {
    background: #a84ae5;
}

ul {
    list-style: none;
    padding: 0;
}

li {
    padding: 4px;
    border-bottom: 1px solid #ccc;
}

.archive {
    background: #faf5ff;
    margin-top: 10px;
    padding: 5px;
    max-height: 180px;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

.count {
    color: #666;
    font-size: 0.9em;
}

.empty {
    color: #666;
}

#mainContent {
    transition: margin 0.3s ease;
}

body.left-open #mainContent {
    margin-left: 250px;
}

body.right-open #mainContent {
    margin-right: 250px;
}

.sidebarBtn {
    background: #c55fff;
    color: #fff;
    border: 1px solid #000;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 6px;
    width: var(--handle-width);
    text-align: center;
    position: fixed;
    top: 40%;
    z-index: 1001;
}

.sidebarBtn:hover {
    background: #a84ae5;
}


.sidebarBtn.left {
    left: 0;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    border-radius: 0 4px 4px 0;
}

.left-open .sidebarBtn.left {
    left: 250px;
}

.sidebarBtn.right {
    right: 0;
    writing-mode: vertical-rl;
    border-radius: 4px 0 0 4px;
}

.right-open .sidebarBtn.right {
    right: 250px;
}

.sidebar { 
    --handle-width: 30px;
    position: fixed;
    top: 0;
    bottom: 0;
    width: 250px;
    background: #fff;
    border: none;
    padding: 10px;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar.open {
    border: 2px solid #000;
}


.sidebar.left {
    left: 0;
    transform: translateX(-100%);
}

.sidebar.right {
    right: 0;
    transform: translateX(100%);
}

.sidebar.open.left {
    transform: translateX(0);
}

.sidebar.open.right {
    transform: translateX(0);
}

#rightSidebar {
    display: flex;
    flex-direction: column;
}

#leftSidebar {
    display: flex;
    flex-direction: column;
}

#leftSidebar ul {
    flex: 1;
    list-style: none;
    padding: 0;
    margin: 0;
}

#saveDBBtn {
    margin-top: 10px;
    width: 100%;
}

.authBox input {
    width: 100%;
    margin-bottom: 10px;
    display: block;
}

#notesBoard {
    flex: 1;
}

#templateEditor {
    border: 2px solid #000;
    padding: 10px;
    margin-top: 10px;
    background: #fff;
}

.autoTask {
    color: #333;
    font-style: italic;
    margin-left: 5px;
}

.planGroup {
    border: 1px solid #000;
    padding: 10px;
    margin-bottom: 10px;
    background: #f0e6ff;
    position: relative;
}

.planGroup h4 {
    margin: 0 0 5px 0;
}

.planGroup .removePlan {
    position: absolute;
    top: 0;
    right: 0;
}

#calendarGrid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.day {
    border: 1px solid #000;
    min-height: 60px;
    padding: 4px;
    position: relative;
    background: #fff;
}

.day.today {
    background: #ffe6e6;
}

.day-name {
    text-align: center;
    font-weight: bold;
}

.day .count {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: #c55fff;
    color: #fff;
    border-radius: 10px;
    padding: 1px 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.day .count.empty {
    background: transparent;
    color: #000;
    cursor: default;
}

#myDayView {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.myday-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.myday-card {
    background: #fff;
    border: 2px solid #000;
    border-radius: 10px;
    padding: 12px;
    flex: 1 1 280px;
    min-width: 260px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.myday-card h2 {
    margin: 0 0 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.myday-task-list li,
.myday-vision-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.myday-vision-list li.done {
    opacity: 0.6;
}

.vision-progress {
    font-size: 0.9em;
    margin-bottom: 6px;
    color: #555;
}

.vision-importance {
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 999px;
    background: #e6dcff;
    color: #5334a6;
    white-space: nowrap;
}

.myday-habits {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.habit-section {
    background: #fff;
    border: 2px solid #000;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.habit-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.habit-section-header h3 {
    margin: 0;
}

.habit-items {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.habit-item {
    background: none;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: inherit;
}

.habit-item:focus-visible {
    outline: 2px solid #c55fff;
    outline-offset: 4px;
}

.habit-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid #c55fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: #f9f4ff;
    transition: background 0.2s ease, color 0.2s ease;
}

.habit-item.done .habit-circle {
    background: #c55fff;
    color: #fff;
}

.habit-label {
    font-size: 0.85em;
    text-align: center;
    max-width: 90px;
    word-break: break-word;
}

.habit-add {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.habit-empty {
    margin: 0;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modalContent {
    background: #fff;
    border: 2px solid #000;
    padding: 20px;
    position: relative;
    max-height: 80%;
    overflow-y: auto;
}

#budgetView {
    margin-top: 10px;
    background: #f8f5ff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}
#budgetView input, #budgetView select {
    margin: 0;
}
#budgetView .formRow {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}
#budgetView .cardRow {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
}
#budgetView .budgetCard {
    background: #f5f0ff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    flex: 1 1 180px;
}
#budgetView .cardTitle {
    font-weight: bold;
    margin-bottom: 4px;
}
#budgetView .opRow, #budgetView .catRow {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
}
#budgetView .opCol, #budgetView .catCol {
    flex: 1 1 250px;
}
#budgetView .opList {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: calc(1.8em * 10);
    overflow-y: auto;
}
#budgetView .opList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #eee;
}
#budgetView .opList li:last-child {
    border-bottom: none;
}
#budgetView .charts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
}

#accumChart {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 5px;
}

#budgetView .chart {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 200px;
}

#budgetView .chartCaption {
    margin: 4px 0;
    font-weight: bold;
}

#accumChart, #budgetView .chart canvas {
    width: 100%;
    height: 200px;
}

#pieTooltip {
    position: absolute;
    background: #fff;
    border: 1px solid #333;
    padding: 4px 6px;
    border-radius: 4px;
    pointer-events: none;
    font-size: 12px;
    z-index: 1000;
}

#budgetView .legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.8em;
    margin-top: 4px;
}

#budgetView .legendItem {
    display: flex;
    align-items: center;
    gap: 4px;
}

#budgetView .legendItem span {
    width: 12px;
    height: 12px;
    display: inline-block;
    border: 1px solid #000;
}
.budgetSection h3 {
    margin: 0 0 10px 0;
}

@media (min-width:1000px) {
    #budgetView {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "title title"
            "cards cards"
            "rec one"
            "cat charts"
            "accum charts";
        max-height: 100vh;
        overflow-y: auto;
    }
    #budgetView h2 { grid-area: title; }
    #budgetView .cardRow { grid-area: cards; }
    #budgetView .recSection { grid-area: rec; }
    #budgetView .oneSection { grid-area: one; }
    #budgetView .catSection { grid-area: cat; }
    #budgetView .accumSection { grid-area: accum; }
    #budgetView .chartSection { grid-area: charts; }
}
.cat {
    margin-right: 5px;
    cursor: pointer;
}
.cat:hover {
    text-decoration: line-through;
}

#goalsBlock {
    margin-top: 10px;
}

#goalsBlock ul {
    padding-left: 20px;
}

.closeBtn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #c55fff;
    color: #fff;
    border: 1px solid #000;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 6px;
}

/* Vision of the future */
#visionView {
    margin-top: 10px;
}

#visionView .visionColumns {
    display: flex;
    gap: 10px;
}

.visionColumn {
    border: 2px solid #000;
    background: #e6ffe6;
    border-radius: 6px;
    padding: 10px;
    width: 180px;
    position: relative;
}

.visionColumn h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
}

.visionColumn .editVision {
    position: absolute;
    top: 0;
    right: 0;
}

.visionColumn .countdown {
    font-size: 0.9em;
    margin-bottom: 5px;
}

.progressBar {
    width: 100%;
    height: 8px;
    background: #ddd;
    margin: 4px 0;
    border: 1px solid #000;
}

.progressBar .progressFill {
    background: #76c043;
    height: 100%;
}

.visionColumn li.done {
    text-decoration: line-through;
    color: #888;
}

#archiveList {
    margin-top: 10px;
}

.archiveYear {
    border: 1px solid #ccc;
    padding: 5px;
    margin-bottom: 8px;
    background: #fafafa;
}

/* Journal week indicator */
#journalHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.journal-day {
    position: relative;
}

.dayPointer {
    position: absolute;
    top: 50%;
    right: -15px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid #0a0;
    cursor: move;
}

.entry-note {
    display: inline;
    font-size: 0.8em;
    color: #888;
    vertical-align: sub;
}

.skillItem {
    margin-bottom: 5px;
}

.skillProgress {
    width: 100%;
    height: 10px;
    background: #eee;
}

.skillBar {
    height: 100%;
    background: #0a0;
}

/* Exercise modal */
#exerciseList {
    margin-bottom: 10px;
}
.exerciseRow {
    margin-bottom: 5px;
}
.exerciseRow input {
    margin-right: 3px;
    width: 80px;
}
.exerciseRow select {
    margin-right: 3px;
}

/* Clone modal */
#cloneContent .clone-entry {
    margin-bottom: 5px;
}
#cloneContent .clone-field {
    display: inline-block;
    margin-right: 10px;
}
