@font-face {
    font-family: 'Mesgentia';
    src: url('../assets/fonts/Mesgentia.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    ascent-override: 100%;
    descent-override: 20%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Mineko';
    src: url('../assets/fonts/Mineko.woff2') format('woff2');
    font-weight: normal;
    font-style: normal;
    ascent-override: 97.5%;
    descent-override: 22.5%;
    line-gap-override: 0%;
}

@font-face {
    font-family: 'Minecraft';
    src: url('../assets/fonts/MinecraftRegular-Bmg3.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Minecraft';
    src: url('../assets/fonts/MinecraftBold-nMK1.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Minecraft';
    src: url('../assets/fonts/MinecraftItalic-R8Mo.otf') format('opentype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Minecraft';
    src: url('../assets/fonts/MinecraftBoldItalic-1y1e.otf') format('opentype');
    font-weight: bold;
    font-style: italic;
}

@font-face {
    font-family: 'Imprima';
    src: url('/assets/fonts/Imprima-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Regular.ttf?v=2') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Bold.ttf?v=2') format('truetype');
    font-weight: bold;
    font-style: normal;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-Italic.ttf?v=2') format('truetype');
    font-weight: normal;
    font-style: italic;
}

@font-face {
    font-family: 'Lora';
    src: url('/assets/fonts/Lora-BoldItalic.ttf?v=2') format('truetype');
    font-weight: bold;
    font-style: italic;
}

:root {
    --primary: #B8878C;
    --primary-light: #c9a8a8;
    --primary-lighter: #e8d4d4;
    --primary-hover: #dcc3c6;
    --background: #FDF8F4;
    --cream: #f8f0f0;
    --text: #4A4A4A;
    --text-muted: #6B6B6B;
    --border: #deb8b8;
    --white: #fff;
    --completed: #9CAF88;
    --scale: 1;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color-scheme: light;
    --sync-fill: #f1f1ef;
    --card-bg: rgba(255, 255, 255, 0.75);
    --grid-bg: linear-gradient(rgba(184, 135, 140, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(184, 135, 140, 0.05) 1px, transparent 1px);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --background: #191919;
        --white: #202020;
        --cream: #2a2a2a;
        --text: #e3e3e2;
        --text-muted: #9b9a97;
        --completed: #9caf88;
        --primary-light: #37352f;
        --primary-lighter: #2f2f2f;
        color-scheme: dark;
        --sync-fill: #2a2a2a;
        --card-bg: rgba(32, 32, 32, 0.75);
    }
}

:root[data-theme="dark"] {
    --background: #191919;
    --white: #202020;
    --cream: #2a2a2a;
    --text: #e3e3e2;
    --text-muted: #9b9a97;
    --completed: #9caf88;
    --primary-light: #37352f;
    --primary-lighter: #2f2f2f;
    color-scheme: dark;
    --sync-fill: #2a2a2a;
    --card-bg: rgba(32, 32, 32, 0.75);
}

:root[data-theme="light"] {
    --background: #FDF8F4;
    --white: #fff;
    --cream: #f8f0f0;
    --text: #4A4A4A;
    --text-muted: #6B6B6B;
    --border: #deb8b8;
    --completed: #9CAF88;
    color-scheme: light;
    --sync-fill: #f1f1ef;
    --card-bg: rgba(255, 255, 255, 0.75);
}

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

button, input, select, textarea {
    font-family: inherit;
}

html {
    background: transparent !important;
}

body {
    font-family: var(--font-family);
    background: transparent !important;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.y2k-window {
    width: 100%;
    max-width: 680px;  
    background-color: var(--white);
    background-image: var(--grid-bg);
    background-size: 8px 8px;
    border: 1px solid var(--border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    zoom: var(--scale);
    box-shadow: none;
}

.y2k-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--white);
}

.y2k-title-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.5px;
}

.y2k-title-bar-left button {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.7;
    transition: opacity 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.y2k-title-bar-left button:hover {
    opacity: 1;
    color: var(--primary);
}

.y2k-title-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.y2k-date-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 999px;
    transition: background-color 0.15s;
}

.y2k-date-btn:hover {
    background: transparent;
}

.y2k-date-btn:hover .y2k-date,
.y2k-date-btn:hover svg {
    color: var(--primary);
    opacity: 1;
}

/* on a colored title bar the date still answers the hover, by softening its own bar text.
   the accent can't be used there: a bar the same color as the accent would swallow it
   (nari, 10/02: the hover shouldn't depend on anyone's title bar color) */
[data-titlebar="custom"] .y2k-title-bar .y2k-date-btn:hover .y2k-date,
[data-titlebar="custom"] .y2k-title-bar .y2k-date-btn:hover svg {
    color: var(--kou-titlebar-text);
    opacity: 0.5;
}

.y2k-date {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.y2k-settings-btn svg {
    transition: transform 0.3s ease;
}
.y2k-settings-btn:hover svg {
    transform: rotate(45deg);
}

.planner-header {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--white);
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.planner-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--text);
    text-transform: uppercase;
}

.header-weekdays {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-weekdays span {
    font-size: 11px;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: 50%;
}

.header-weekdays span.active {
    border: 1px solid var(--primary);
    color: var(--primary);
    font-weight: 700;
}

.productivity-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
}

.y2k-footer {
    display: flex;
    justify-content: flex-end;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    background: var(--white);
}

.clear-btn {
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    padding: 4px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--cream);
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1.4;
    transition: opacity 0.15s ease, background-color 0.15s, color 0.15s;
    opacity: 0;
    pointer-events: none;
}

.clear-btn:hover {
    background: var(--primary-hover);
    color: var(--primary);
}

.productivity-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.productivity-scale {
    display: flex;
    background: var(--primary-lighter);
    padding: 2px;
    border-radius: 999px;
    border: 1px solid var(--border);
}

.prod-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    padding: 0 !important;
    appearance: none;
    -webkit-appearance: none;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.15s, color 0.15s;
}

.prod-btn:hover {
    background: var(--primary-hover);
    color: var(--primary);
}

.prod-btn.active {
    background: var(--primary);
    color: var(--on-accent, #fff);
}

.planner-body {
    display: flex;
    flex-direction: column;
}

.section-card {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.grid-table {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.grid-header-row {
    display: grid;
    grid-template-columns: 1fr 65px 65px 75px 40px 30px;
    gap: 8px;
    overflow: hidden;
    scrollbar-gutter: stable;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 12px 4px 12px;
    margin-top: -2px;
    border-bottom: 1px dotted var(--border);
}

.grid-header-row span,
.sessions-header span {
    display: flex;
    align-items: center;
}

.grid-header-row span.center,
.sessions-header span.center {
    justify-content: center;
}

.grid-data-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.grid-row {
    display: grid;
    grid-template-columns: 1fr 65px 65px 75px 40px 30px;
    gap: 8px;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    transition: background-color 0.15s;
}

.grid-row:hover {
    background: var(--primary-hover);
}

.grid-cell {
    display: flex;
    align-items: center;
}

.grid-cell.center {
    justify-content: center;
}

.task-item-text {
    font-size: 12px;
    color: var(--text);
    word-break: break-all;
    cursor: pointer;
}

.grid-row.completed .task-item-text {
    text-decoration: line-through;
    color: var(--text-muted);
    opacity: 0.6;
}

.pom-badge {
    font-size: 11px;
    color: var(--text);
}

.pom-badge.center {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.editable-cell {
    cursor: pointer;
    transition: background-color 0.15s;
    border-radius: 999px;
    padding: 2px 8px;
    min-width: 30px;
    min-height: 18px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.editable-cell:hover {
    background: var(--primary-hover);
}

.editable-cell:has(input) {
    padding: 0;
    background: transparent;
}

.editable-text {
    cursor: pointer;
}

.edit-input {
    width: 100%;
    max-width: 55px;
    height: 18px;
    padding: 0 6px;
    font-size: 11px;
    border: 1px solid var(--primary);
    background: var(--white);
    color: var(--text);
    border-radius: 999px;
    text-align: center;
    outline: none;
}

.edit-input.edit-input-wide {
    max-width: 100%;
    text-align: left;
}

.planner-input {
    width: 100%;
    padding: 6px 12px;
    font-size: 11px;
    line-height: 13px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    border-radius: 999px;
    outline: none;
    transition: border-color 0.15s;
}

.planner-input:focus {
    border-color: var(--primary);
}

.planner-input.center {
    text-align: center;
}

#task-target-input {
    max-width: 44px;
    margin: 0 auto;
    padding: 6px 6px;
}

#sess-start-input,
#sess-end-input {
    padding: 6px 6px;
}

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type=number] {
    -moz-appearance: textfield;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 65px 65px 75px 40px 30px;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
    padding: 6px 12px;
    overflow: hidden;
    scrollbar-gutter: stable;
}

.add-circle-btn {
    width: 27px;
    height: 27px;
    min-width: 27px;
    min-height: 27px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    padding: 0 !important;
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--on-accent, #fff);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.15s;
}

.add-circle-btn svg {
    width: 12px;
    height: 12px;
    fill: #ffffff !important;
    display: block;
}

.add-circle-btn:hover {
    background: var(--primary);
    filter: brightness(0.9);
}

.add-circle-btn:active {
    transform: scale(0.9);
}

.bottom-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    background: var(--card-bg);
}

@media (max-width: 640px) {
    .bottom-grid {
        grid-template-columns: 1fr;
    }
    .bottom-grid > div:first-child {
        border-bottom: 1px solid var(--border);
    }
}

.bottom-left {
    padding: 16px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 226px;
}

@media (max-width: 640px) {
    .bottom-left {
        border-right: none;
    }
}

.bottom-right {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 226px;
}

.bottom-right > div {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.sessions-table {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sessions-header {
    display: grid;
    grid-template-columns: 1fr 55px 55px 40px 30px;
    gap: 8px;
    overflow: hidden;
    scrollbar-gutter: stable;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 12px 4px 12px;
    margin-top: -2px;
    border-bottom: 1px dotted var(--border);
}

.sessions-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.session-row {
    display: grid;
    grid-template-columns: 1fr 55px 55px 40px 30px;
    gap: 8px;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    transition: background-color 0.15s;
}

.session-row:hover {
    background: var(--primary-hover);
}

.session-row.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
    opacity: 0.6;
}

.session-input-row {
    display: grid;
    grid-template-columns: 1fr 55px 55px 40px 30px;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
    padding: 6px 12px;
    overflow: hidden;
    scrollbar-gutter: stable;
}

@media (max-width: 520px) {
    .grid-header-row,
    .grid-row,
    .input-row {
        grid-template-columns: minmax(0, 1fr) 38px 38px 50px 18px 14px;
        gap: 4px;
    }
    .sessions-header,
    .session-row,
    .session-input-row {
        grid-template-columns: minmax(0, 1fr) 44px 44px 18px 14px;
        gap: 4px;
    }
    .grid-header-row,
    .sessions-header {
        padding-left: 6px;
        padding-right: 6px;
        font-size: 8px;
        letter-spacing: 0;
    }
    .grid-header-row span.center,
    .sessions-header span.center {
        text-align: center;
    }
    .grid-row,
    .input-row,
    .session-row,
    .session-input-row {
        padding-left: 6px;
        padding-right: 6px;
    }
    .task-item-text {
        word-break: normal;
        overflow-wrap: anywhere;
    }
    .editable-cell {
        padding: 2px 2px;
        min-width: 0;
    }
    .edit-input {
        padding: 0 2px;
    }
    .delete-row-btn {
        padding: 2px;
    }
    #task-target-input {
        max-width: 100%;
        padding: 6px 2px;
    }
    #sess-start-input,
    #sess-end-input {
        padding: 6px 2px;
    }
    .session-input-row > .grid-cell {
        grid-column: 4 / span 2;
    }
    .session-input-row > div:last-child {
        display: none;
    }
    .prod-btn {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
    }
}

@media (max-width: 400px) {
    body {
        padding: 8px;
    }
    .section-card,
    .bottom-left,
    .bottom-right {
        padding: 10px;
    }
}

@media (max-width: 300px) {
    .input-row {
        row-gap: 8px;
    }
    #task-name-input {
        grid-column: 1 / -1;
    }
    #task-target-input {
        grid-column: 2;
    }
    .input-row > .grid-cell {
        grid-column: 3;
    }
    .input-row > div:not(.grid-cell) {
        display: none;
    }
}

.breaks-list {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.break-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    transition: background-color 0.15s;
}

.break-item:hover {
    background: var(--primary-hover);
}

.break-text {
    font-size: 12px;
    color: var(--text);
    flex: 1;
    cursor: pointer;
}

.break-item.completed .break-text {
    text-decoration: line-through;
    color: var(--text-muted);
    opacity: 0.6;
}

.break-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 12px;
}

.notes-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 120px;
}

.notes-textarea {
    flex: 1;
    width: 100%;
    min-height: 100px;
    padding: 10px;
    font-size: 12px;
    color: var(--text);
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    resize: vertical;
    line-height: 1.5;
    background-image: linear-gradient(var(--border) 1px, transparent 1px);
    background-size: 100% 24px;
}

.y2k-checkbox {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    transition: background-color 0.15s, border-color 0.15s;
}

.y2k-checkbox:hover {
    border-color: var(--primary);
    background: var(--primary-hover);
}

.y2k-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.y2k-checkbox svg {
    width: 10px;
    height: 10px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.15s;
}

.y2k-checkbox.square {
    border-radius: 4px;
}

.y2k-checkbox.diamond {
    border-radius: 4px;
    transform: rotate(45deg);
}

.y2k-checkbox.diamond svg {
    transform: rotate(-45deg);
}

.y2k-checkbox.heart,
.y2k-checkbox.star,
.y2k-checkbox.pixel-heart {
    background: transparent !important;
    border: none;
}

.y2k-checkbox.heart svg,
.y2k-checkbox.star svg,
.y2k-checkbox.pixel-heart svg {
    width: 16px;
    height: 16px;
    stroke: var(--border);
    stroke-width: 1.5px;
    fill: transparent;
    opacity: 1;
}

.y2k-checkbox.heart.checked svg,
.y2k-checkbox.star.checked svg {
    stroke: var(--primary);
    fill: var(--primary);
}

.y2k-checkbox.pixel-heart svg {
    stroke: none !important;
    stroke-width: 0 !important;
    fill: none;
}

.y2k-checkbox.pixel-heart svg .outline-path {
    fill: var(--border);
    display: block;
}

.y2k-checkbox.pixel-heart svg .filled-path {
    display: none;
}

.y2k-checkbox.pixel-heart:hover svg .outline-path {
    fill: var(--primary);
}

.y2k-checkbox.pixel-heart.checked svg .outline-path {
    display: none;
}

.y2k-checkbox.pixel-heart.checked svg .filled-path {
    display: block;
    fill: var(--primary);
}

.y2k-checkbox.crescent {
    background: transparent;
    border: none;
}

.y2k-checkbox.crescent svg {
    width: 16px;
    height: 16px;
    stroke: var(--border);
    stroke-width: 1.5px;
    fill: transparent;
    opacity: 1;
}

.y2k-checkbox.crescent:hover svg {
    stroke: var(--primary);
}

.y2k-checkbox.crescent.checked svg {
    stroke: var(--primary);
    fill: var(--primary);
}

.delete-row-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s, color 0.15s;
}

.delete-row-btn:hover {
    opacity: 1;
    color: var(--primary);
}

.empty-data-row {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.6;
    text-align: center;
    padding: 12px;
}

.grid-header-row::-webkit-scrollbar,
.grid-data-rows::-webkit-scrollbar,
.input-row::-webkit-scrollbar,
.sessions-header::-webkit-scrollbar,
.sessions-list::-webkit-scrollbar,
.session-input-row::-webkit-scrollbar,
.breaks-list::-webkit-scrollbar {
    width: 4px;
}

.grid-header-row::-webkit-scrollbar-track,
.grid-data-rows::-webkit-scrollbar-track,
.input-row::-webkit-scrollbar-track,
.sessions-header::-webkit-scrollbar-track,
.sessions-list::-webkit-scrollbar-track,
.session-input-row::-webkit-scrollbar-track,
.breaks-list::-webkit-scrollbar-track {
    background: transparent;
}

.grid-data-rows::-webkit-scrollbar-thumb,
.sessions-list::-webkit-scrollbar-thumb,
.breaks-list::-webkit-scrollbar-thumb {
    background: var(--primary-lighter);
    border-radius: 2px;
}

html.hide-grid .y2k-window {
    background-image: none !important;
}

html.hide-border .y2k-title-bar,
html.hide-border .planner-header,
html.hide-border .section-card,
html.hide-border .bottom-grid,
html.hide-border .bottom-left {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

html.hide-border .y2k-window {
    border: none !important;
    box-shadow: none !important;
}

html.hide-border.hide-grid .y2k-window {
    background: transparent !important;
}

html.hide-border .notes-textarea {
    border: 1px solid transparent !important;
}

.date-picker-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: none;
    z-index: 1100;
    box-sizing: border-box;
    box-shadow: none;
}

.date-picker-overlay.active {
    display: block;
}

.date-picker-popup {
    padding: 10px;
}

.date-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.date-picker-nav {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: background-color 0.15s;
}

.date-picker-nav:hover {
    background: var(--primary-hover);
}

.date-picker-month {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
}

.date-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--primary-lighter);
}

.date-picker-weekdays span {
    font-size: 8px;
    color: var(--text-muted);
    font-weight: 500;
}

.date-picker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

.datepicker-day {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text);
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.15s;
}

.datepicker-day:hover {
    background: var(--primary-hover);
}

.datepicker-day.empty {
    cursor: default;
    pointer-events: none;
    opacity: 0.3;
}

.datepicker-day.selected {
    background: var(--primary);
    color: var(--on-accent, #fff);
    font-weight: 700;
}

.date-picker-today {
    width: 100%;
    padding: 6px;
    font-size: 10px;
    background: var(--primary-lighter);
    color: var(--primary);
    border: none;
    border-radius: 999px;  
    cursor: pointer;
    font-weight: 600;
    margin-top: 6px;
}

.date-picker-today:hover {
    background: var(--primary-hover);
    color: #fff;
}

.settings-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    max-height: 75vh;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: none;
    z-index: 1000;
    box-shadow: none;
    overflow: hidden;
    box-sizing: border-box;
}

.settings-panel.active {
    display: block;
}

.settings-content {
    padding: 12px;
    max-height: calc(75vh - 4px);
    overflow-y: auto;
    overflow-x: hidden;
}

.settings-content::-webkit-scrollbar {
    width: 4px;
}

.settings-content::-webkit-scrollbar-track {
    background: transparent;
}

.settings-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 2px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--primary-lighter);
}

.settings-header h3 {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-close {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    padding: 0 !important;
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.5;
    transition: opacity 0.15s, background-color 0.15s;
}

.settings-close:hover {
    opacity: 1;
    background: var(--primary-hover);
}

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

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

.settings-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    display: block;
}

.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

#settings-color {
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--primary-lighter);
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
}

#settings-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

#settings-color::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

/* title bar swatch comes from kou-theme.css at 28px; every swatch stays even with its hex box */
.settings-panel #titlebar-color,
.settings-panel .titlebar-clear {
    width: 18px;
    height: 18px;
}

/* the clear x is just the x: no pad shape, full strength so it reads in light and dark */
.settings-panel .titlebar-clear {
    background: none;
    opacity: 1;
    margin-left: -6px;
}

/* a 10px x; its ink sits 8px from the hex box, the same gap as the swatch (nari, 10/02) */
.settings-panel .titlebar-clear svg {
    width: 10px;
    height: 10px;
}

.settings-panel .titlebar-clear:hover {
    color: var(--text);
}

.color-hex {
    width: 62px;
    height: 18px;
    font-size: 10px;
    font-family: inherit;
    color: var(--text);
    font-weight: 400;
    background: var(--primary-lighter);
    border: none;
    border-radius: 999px;  
    padding: 3px 6px;
    text-align: center;
    outline: none;
    transition: background-color 0.15s ease;
}

.color-hex:focus {
    background: var(--primary-light);
}

.shape-toggle {
    display: flex;
    gap: 4px;
}

.shape-btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    padding: 0 !important;
    appearance: none;
    -webkit-appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    border-radius: 50%;  
    cursor: pointer;
    transition: all 0.15s ease;
}

.shape-btn:hover {
    background: var(--primary-hover);
    color: var(--primary);
}

/* the selected shape matches the settings icon picker: soft fill, no outline */
.shape-btn.active {
    background: var(--primary-lighter);
    border-color: transparent;
}

.shape-btn svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: color 0.15s ease;
}

.shape-btn.active svg,
.shape-btn:hover svg {
    color: var(--primary);
}

.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.size-slider {
    flex: 1;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--primary-lighter);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.size-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.slider-value {
    font-size: 10px;
    color: var(--text-muted);
    min-width: 45px;
    text-align: right;
}

.y2k-select {
    width: 100%;
    font-size: 10px;
    font-family: inherit;
    color: var(--text);
    background: var(--primary-lighter);
    border: none;
    border-radius: 999px;  
    padding: 6px 30px 6px 12px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 1 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: background-color 0.15s ease;
}

.y2k-select:focus {
    background: var(--primary-light);
}

.y2k-select option {
    background: var(--white);
    color: var(--text);
}

.setting-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.setting-toggle-row .settings-label {
    margin-bottom: 0;
}

.cute-toggle {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
}

.cute-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--primary-lighter);
    transition: .2s ease;
    border-radius: 999px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: var(--white);
    transition: .2s ease;
    border-radius: 50%;
}

.cute-toggle input:checked + .toggle-slider {
    background-color: var(--primary);
}

.cute-toggle input:checked + .toggle-slider:before {
    transform: translateX(14px);
}

.sync-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--primary-lighter);
}

.sync-section label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.sync-status-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.sync-status-text.synced {
    color: var(--primary);
}

.sync-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.sync-buttons-row {
    display: flex;
    flex-direction: row;
    gap: 6px;
    width: 100%;
}

.sync-buttons-row .sync-btn {
    flex: 1;
    min-width: 0;
    font-size: 10px;
}

.sync-btn {
    flex: 1;
    min-width: 60px;
    padding: 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--primary);
    color: var(--on-accent, white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: normal;
}

.sync-btn:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.sync-btn:active {
    transform: scale(0.98);
}

.sync-btn.secondary {
    background: var(--sync-fill);
    color: var(--text);
}

.sync-btn.danger {
    background: rgba(231, 76, 60, 0.15);
    color: #c0392b;
}

.sync-btn.danger:hover {
    background: rgba(231, 76, 60, 0.25);
}

#sync-code-input {
    flex: 1;
    min-width: 60px;
    padding: 6px 10px;
    border: none;
    border-radius: 999px;
    font-size: 9px;
    font-family: inherit;
    background: var(--primary-lighter);
    transition: background-color 0.15s ease;
    color: var(--text);
}

#sync-code-input:focus {
    outline: none;
    background: var(--primary-light);
}

.sync-hint {
    font-size: 9px;
    color: var(--text-muted);
    margin: 12px 0 0 0;
    text-align: center;
}

.sync-status-panel {
    background: var(--primary-lighter);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--primary-lighter);
}

.sync-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    min-height: 24px;
}

.sync-status-row:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

:root[data-theme="dark"] .sync-status-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .sync-status-row:not(:last-child) {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
}

.sync-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.3;
}

.sync-value {
    font-size: 10px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.3;
    display: flex;
    align-items: center;
}

.sync-time-value {
    color: var(--text-muted);
    font-size: 10px;
}

.sync-code-row {
    flex-wrap: nowrap;
    gap: 6px;
}

.sync-code-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: var(--white);
    border-radius: 999px;
    border: 1px solid var(--primary-lighter);
    min-width: 0;
    flex-shrink: 1;
    max-width: 100%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sync-code-pill:hover {
    background: var(--primary-hover);
}

.sync-code-pill:active {
    transform: scale(0.97);
}

.sync-code-value {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.3px;
    margin-top: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-link-section {
    margin-top: 12px;
    padding-top: 12px;
    margin-bottom: 12px;
    border-top: 1px solid var(--primary-lighter);
}

.share-link-section label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
}

.share-link-container {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-lighter);
    border-radius: 999px;
    padding: 6px 6px 6px 12px;
}

.share-link-input {
    flex: 1;
    min-width: 0;
    padding: 6px 0;
    border: none;
    background: transparent;
    font-size: 11px;
    font-family: inherit;
    color: var(--text);
    outline: none;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.share-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: var(--primary);
    color: var(--on-accent, white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.share-copy-btn:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.share-copy-btn:active {
    transform: scale(0.98);
}

.share-copy-btn svg {
    width: 11px;
    height: 11px;
    flex-shrink: 0;
}

.sync-error-panel {
    background: rgba(231, 76, 60, 0.1);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(231, 76, 60, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sync-error-icon {
    font-size: 16px;
    color: #c0392b;
}

.sync-error-message {
    font-size: 11px;
    color: #c0392b;
    flex: 1;
}

.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);

    color: var(--primary);
    font-size: 11px;
    font-weight: 600;

    opacity: 0;
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    pointer-events: none;
}

.toast-notification.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.y2k-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    transition: background-color 0.15s, color 0.15s;
}

.y2k-settings-btn:hover {
    background: var(--primary-hover);
    color: var(--primary);
}

.y2k-settings-btn svg {
    transition: transform 0.3s;
}

.y2k-settings-btn:hover svg {
    transform: rotate(45deg);
}

[data-shape="square"] .header-weekdays span,
[data-shape="square"] .productivity-scale,
[data-shape="square"] .clear-btn,
[data-shape="square"] .prod-btn,
[data-shape="square"] .datepicker-day,
[data-shape="square"] .date-picker-today {
    border-radius: 0;
}

.y2k-window > .y2k-title-bar {
    background-color: var(--white);
    background-image: linear-gradient(var(--kou-titlebar-bg), var(--kou-titlebar-bg));
}

[data-shape="square"] .grid-row,
[data-shape="square"] .editable-cell,
[data-shape="square"] .session-row,
[data-shape="square"] .break-item,
[data-shape="square"] .date-picker-overlay,
[data-shape="square"] .date-picker-nav {
    border-radius: 0;
}

[data-shape="square"] #sync-code-input {
    border-radius: 0;
}

.window-style-toggle .window-style-btn.active {
    color: var(--on-accent, var(--white));
}


/* the embed block is the first thing inside the sync section, so its own top
   margin, padding and border doubled the section's own. one divider, not two.
   nari spotted the gap in koucard 2026-10-01. */
.sync-section > .share-link-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* the title stays put while the settings scroll, like kourie's. it sits outside
   the scroller now, in the same spot as before, and the scroller keeps its 4px
   gutter so the line under the title ends where the rows do. nari 2026-10-02. */
.settings-panel.active {
    display: flex;
    flex-direction: column;
}

.settings-panel > .settings-header {
    flex-shrink: 0;
    margin: 12px 16px 0 12px;
}

.settings-panel > .settings-content {
    min-height: 0;
    scrollbar-gutter: stable;
}

/* the pill words (Curve / Square, Outline / Filled): the line is trimmed to the letters, then
   lifted so the middle point between the capital tops and the lowercase tops sits at the middle
   of the pill. it reads each font's own cap and x-heights, so it fits every widget font; same 25px
   pill. browsers without text-box or the cap unit keep a centered line. nari, 10/02 */
.settings-panel .window-style-btn {
    text-box: trim-both cap alphabetic;
    height: 25px;
    padding-top: 0;
    padding-bottom: 0;
    padding-bottom: calc((1cap - 1ex) / 2);
}

/* Imprima sits a hair high with the rule above, so it comes down a quarter pixel (nari's pick) */
@container style(--font-family: 'Imprima', sans-serif) {
    .settings-panel .window-style-btn {
        padding-bottom: calc((1cap - 1ex) / 2 - 0.5px);
    }
}
