

:root {
    --accent-color: #6c5ce7;
    --accent-hover: #5b4cc4;
    --accent-light: rgba(108, 92, 231, 0.25);
    --bg-color: #120f1d;
    --card-bg: #1a1528;
    --border-color: #2d2250;
    --text-color: #e2def8;
    --muted-color: var(--muted-color, #6e6a8a);
    
    --surface: #231b36;
    --surface-hover: #2d2444;
    --input-bg: #120f1d;
    --title-color: var(--title-color, #c3a9f8);
    --heading-color: var(--heading-color, #9569ee);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 40px 20px;
    background: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background 0.35s ease, color 0.35s ease;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 24px 28px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    margin-bottom: 20px;
    width: 100%;
    max-width: 650px;
    box-sizing: border-box;
    transition: background 0.35s ease, border-color 0.35s ease;
}

h2, h3 {
    color: var(--heading-color, #9569ee);
    margin-top: 0;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.top-bar-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.app-title {
    font-size: 1.3rem;
    font-weight: 1000;
    color: var(--title-color, #c3a9f8);
    letter-spacing: 0.5px;
}

.top-bar-date {
    font-size: 0.8rem;
    color: var(--muted-color, #6e6a8a);
}

.top-bar-clock {
    font-size: 0.85rem;
    color: var(--accent-color, #00cec9);
    font-weight: 600;
}

.flap-clock {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-variant-numeric: tabular-nums;
}
.flap-digit {
    position: relative;
    width: 28px;
    height: 38px;
    perspective: 140px;
}
.flap-digit.flap-empty {
    width: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
}
.flap-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 38px;
    background: linear-gradient(180deg, var(--surface-hover, #2a2438) 0%, var(--surface, #1a1528) 50%, var(--bg-color, #120f1d) 100%);
    border: 1px solid var(--border-color, #3d315f);
    border-radius: 6px;
    color: var(--text-color, #e2def8);
    font-size: 1.2rem;
    font-weight: 800;
    font-family: "SF Mono", "Consolas", "Courier New", monospace;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.08),
        0 2px 5px rgba(0,0,0,0.35);
    line-height: 1;
}
.flap-digit::after {
    content: "";
    position: absolute;
    left: 1px;
    right: 1px;
    top: 50%;
    height: 1px;
    background: rgba(0,0,0,0.45);
    pointer-events: none;
    z-index: 2;
}
.flap-digit.flap-flip .flap-card {
    animation: flapTick 0.35s ease;
}
@keyframes flapTick {
    0%   { transform: rotateX(0deg); }
    40%  { transform: rotateX(-75deg); }
    100% { transform: rotateX(0deg); }
}
.flap-colon {
    color: var(--text-color, #e2def8);
    font-weight: 800;
    font-size: 1.25rem;
    padding: 0 2px;
    font-family: "SF Mono", "Consolas", "Courier New", monospace;
    animation: colonBlink 1.2s step-end infinite;
}
@keyframes colonBlink {
    50% { opacity: 0.25; }
}

.flap-ampm {
    margin-left: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 38px;
    padding: 0 8px;
    background: linear-gradient(180deg, var(--surface-hover, #2a2438) 0%, var(--surface, #1a1528) 50%, var(--bg-color, #120f1d) 100%);
    border: 1px solid var(--border-color, #3d315f);
    border-radius: 6px;
    color: var(--text-color, #e2def8);
    font-size: 1rem;
    font-weight: 800;
    font-family: "SF Mono", "Consolas", "Courier New", monospace;
    letter-spacing: 0.04em;
    line-height: 1;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.08),
        0 2px 5px rgba(0,0,0,0.35);
}

.divider {
    height: 1px;
    background: var(--surface-hover, #2d2444);
    margin: 12px 0;
}

.day-label {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--title-color, #d1baff);
}

.checkin-prompt {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: var(--accent-color);
    min-height: 1em;
}

.add-block-btn {
    margin-top: 8px;
    background: transparent;
    border: 1px dashed var(--border-color, #3d315f);
    color: var(--accent-color);
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.add-block-btn:hover {
    background: var(--surface, #231b36);
    border-color: var(--accent-color);
    color: #fff;
}

label {
    color: var(--muted-color, #b1a7d8);
}

.day-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 5px;
    margin-bottom: 20px;
}

.day-tab {
    background: var(--surface, #231b36);
    border: 2px solid var(--border-color, #3d315f);
    color: var(--muted-color, #aba1db);
    padding: 8px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    flex: 1;
    text-align: center;
    transition: all 0.2s;
    white-space: nowrap;
}

.day-tab:hover {
    background: var(--surface-hover, #2d2444);
    border: 2px solid var(--border-color, #37285f);
    color: var(--text-color, #f0ecff);
}

.day-tab.active {
    background: var(--accent-color) !important;
    border-color: var(--accent-color);
    color: white;
    box-shadow: 0 0 7px var(--accent-light);
}

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

.nav-btn {
    background: var(--surface, #231b36);
    border: 2px solid var(--border-color, #3d315f);
    color: var(--title-color, #d1baff);
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
}

.nav-btn:hover {
    background: var(--surface-hover, #2d2444);
    border: 2px solid var(--border-color, #37236e);
}

.schedule-info-banner {
    background: var(--bg-color, #171223);
    border: 2px solid var(--border-color, #2d2444);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 13px;
    color: var(--accent-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.task-block-wrap {
    margin-bottom: 8px;
}

.task-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
    align-items: center;
    background: var(--surface, #1e1830);
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border-color, #352a53);
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    cursor: pointer;
}

.task-row:hover:not(.completed) {
    border-color: var(--accent-color);
    background: color-mix(in srgb, var(--surface, #1e1830) 88%, var(--accent-color) 12%);
    box-shadow: 0 0 0 1px var(--accent-light, rgba(108,92,231,0.25));
}

.task-row.pop-out:not(.completed) {
    border-color: var(--accent-color);
    z-index: 10;
    position: relative;
}

.task-row.completed {
    opacity: 0.55;
}

.task-row.completed:hover {
    box-shadow: none;
}

.task-row.active-now {
    border-color: var(--accent-color);
    box-shadow: 0 0 14px var(--accent-light, rgba(108,92,231,0.35));
    background: color-mix(in srgb, var(--surface, #1e1830) 82%, var(--accent-color) 18%);
}

.task-row.sleep-block {
    border-color: var(--border-color, #4a3f6b);
    background: var(--bg-color, #1a1630);
    opacity: 0.75;
}

.task-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color, #6c5ce7);
    flex-shrink: 0;
    cursor: pointer;
}

.task-row .time-display {
    flex-shrink: 0;
    min-width: 52px;
    padding: 6px 8px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted-color, #a094b3);
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    border: 1px solid var(--border-color, #352a53);
}

.task-row .task-name-display {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    font-size: 0.92rem;
    color: var(--text-color, #f0ecff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-row .delete-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 80, 100, 0.18);
    color: #ff6b81;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.task-row .delete-btn:hover {
    background: rgba(255, 80, 100, 0.35);
}

.task-row.completed .task-name-display {
    text-decoration: line-through;
    opacity: 0.6;
}

.input, select {
    padding: 10px;
    background: var(--input-bg, #120f1d);
    border: 1px solid var(--border-color, #3d315f);
    border-radius: 6px;
    color: var(--text-color, #f0ecff);
    font-size: 14px;
    box-sizing: border-box;
}

input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

input[type="text"] {
    flex: 1 1 0;
    min-width: 0;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
    cursor: pointer;
    flex-shrink: 0;
}

button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

button:hover {
    background: var(--accent-hover);
}

.delete-btn {
    background: #ff4757;
    padding: 8px 12px;
}

.delete-btn:hover {
    background: #ff6b81;
}

#checkin-card {
    background: var(--surface, #1f1733);
    border-left: 6px solid var(--accent-color);
}

.save-master-btn {
    background: #00b85c;
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 10px;
}

.save-master-btn:hover {
    background: #177934;
}

.save-status {
    text-align: center;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #36da88;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.save-status.show {
    opacity: 1;
    transform: translateY(0);
}

.notes-section {
    margin-top: 20px;
}

.notes-section textarea {
    width: 100%;
    height: 70px;
    resize: vertical;
    background: var(--input-bg, #120f1d);
    border: 1px solid var(--border-color, #3d315f);
    border-radius: 6px;
    color: var(--text-color, #f0ecff);
    padding: 10px;
    font-family: inherit;
    box-sizing: border-box;
}

.category-badge { display: none; }

#progress-tracker-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid rgba(162, 155, 254, 0.2);
}

#next-task-badge {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: bold;
}

.chip-now {
    background: var(--accent-light) !important;
    border: 2px solid var(--accent-color) !important;
    color: #ffffff !important;
}

.chip-now .chip-label {
    background: var(--accent-color) !important;
    color: #ffffff;
}

.chip-next {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.12);
    color: #dfe6e9;
}

.chip-next .chip-label {
    background: rgba(255, 255, 255, 0.15);
    color: #b2bec3;
}

.chip-idle {
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--muted-color, #8f87ae);
}
.chip-idle .chip-label {
    background: rgba(255, 255, 255, 0.12);
    color: var(--muted-color, #8f87ae);
}

.chip-label {
    font-size: 0.72rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chip-time {
    opacity: 0.75;
    font-size: 0.82rem;
}

.preset-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    height: 100vh;
    background: var(--card-bg, #181528);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.preset-sidebar.open,
.preset-sidebar:hover {
    transform: translateX(0);
}

.sidebar-toggle-btn {
    position: absolute;
    top: 25px;
    left: -78px;
    background: var(--accent-color) !important;
    color: #ffffff;
    border: none;
    padding: 10px 14px;
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: -4px 2px 12px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle-btn:hover {
    background: var(--accent-hover) !important;
}

.sidebar-content {
    padding: 24px 20px;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.sidebar-group {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    padding: 14px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.sidebar-group label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
}

.sidebar-group select,
.sidebar-group input {
    width: 100%;
    background: var(--input-bg, #110e1c);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.15));
    color: var(--text-color, #ffffff);
}

.btn-primary { background: var(--accent-color); color: white; }
.btn-warning { background: #e17055; color: white; }
.btn-info    { background: #0984e3; color: white; }
.btn-danger  { background: #d63031; color: white; }

.theme-swatches {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

.swatch:hover {
    transform: scale(1.15);
    border-color: #ffffff;
}

.preset-manager {
    padding: 10px 0;
    color: var(--text-color, #fff);
}

.preset-box {
    margin-bottom: 12px;
}

.input-group {
    display: flex;
    gap: 6px;
}

.input-group input, .builder-title-input {
    flex: 1;
    background: var(--surface, #25213b);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

.preset-btn {
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.btn-save { background: var(--accent-color); color: white; }
.btn-create-scratch {
    width: 100%;
    background: #20bf6b;
    color: white;
    margin-top: 8px;
    padding: 10px;
}

.btn-analyse {
    width: 100%;
    background: var(--accent-color);
    color: white;
    margin-top: 6px;
    padding: 10px;
}

.analyser-box {
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
}

.analyser-subtitle {
    font-size: 0.85rem;
    color: var(--accent-color);
    margin: 0 0 12px;
}

.intent-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.intent-pill {
    background: var(--surface, #25213b);
    border: 2px solid var(--border-color, #3d315f);
    color: #ccc;
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
}

.intent-pill:hover {
    border-color: var(--accent-color);
    color: #fff;
}

.intent-pill.selected {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.btn-analyse-run {
    width: 100%;
    background: #0984e3;
    color: white;
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    margin-bottom: 16px;
}

.analyser-results-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.analyser-day-card {
    background: var(--surface, #1e1a30);
    border: 1px solid var(--border-color, #2d2444);
    border-radius: 10px;
    padding: 12px 14px;
}

.analyser-day-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--title-color, #d1baff);
    margin-bottom: 8px;
}

.analyser-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    margin-bottom: 4px;
    color: #ccc;
}

.analyser-check .icon-ok  { color: #20bf6b; }
.analyser-check .icon-warn { color: #fdcb6e; }
.analyser-check .icon-bad  { color: #ff4757; }

.analyser-summary {
    background: var(--bg-color, #12101f);
    border: 1px solid var(--border-color, #2d2444);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.82rem;
    color: var(--accent-color);
    margin-bottom: 10px;
    line-height: 1.6;
}

.sidebar-divider {
    border: 0;
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 15px 0;
}

.preset-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface, #201c33);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-color, #e2def8);
    border: 1px solid var(--border-color, transparent);
}

.preset-item-actions {
    display: flex;
    gap: 4px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.8;
}

.btn-icon:hover { opacity: 1; }

.analytics-bar-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.analytics-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: #dfe6e9;
}

.analytics-bar-track {
    height: 8px;
    background: var(--input-bg, #110e1c);
    border-radius: 4px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
}

.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--card-bg, #181528);
    width: 90%;
    max-width: 550px;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    color: var(--text-color, #e2def8);
    transition: background 0.3s, border-color 0.3s;
}

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

.close-btn { background: none; border: none; color: #aaa; cursor: pointer; font-size: 1.2rem; }

.builder-tabs {
    display: flex;
    gap: 4px;
    margin: 12px 0;
    overflow-x: auto;
}

.builder-tab {
    background: var(--surface, #25213b);
    color: #ccc;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.builder-tab.active {
    background: var(--accent-color);
    color: white;
    font-weight: bold;
}

.builder-input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.builder-input-row input {
    background: var(--surface, #25213b);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.btn-add-slot {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.builder-tasks-list {
    max-height: 180px;
    overflow-y: auto;
    background: var(--bg-color, #12101f);
    padding: 8px;
    border-radius: 6px;
}

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

.btn-cancel { background: #4b6584; color: white; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; }
.btn-save-final { background: #20bf6b; color: white; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-weight: bold; }

.preview-block-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.preview-time {
    font-size: 0.75rem;
    color: var(--accent-color);
    white-space: nowrap;
    min-width: 95px;
}

.preview-task-input {
    flex: 1;
    background: var(--surface, #25213b);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.82rem;
}

#ai-chat-widget {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 10000;
}

#ai-chat-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    font-size: 1.5rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#ai-chat-toggle:hover {
    transform: scale(1.1);
}

#ai-chat-window {
    position: absolute;
    bottom: 65px;
    left: 0;
    width: 330px;
    height: 420px;
    background: var(--card-bg, #181528);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
    transition: all 0.3s ease;
}

#ai-chat-window.chat-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.chat-header {
    background: var(--bg-color, #12101f);
    padding: 12px;
    font-weight: bold;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-header button {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
}

#chat-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.3;
}

.bot-msg {
    background: var(--surface, #25213b);
    color: var(--text-color, #e0e0e0);
    align-self: flex-start;
}

.user-msg {
    background: var(--accent-color);
    color: white;
    align-self: flex-end;
}

.chat-input-area {
    display: flex;
    padding: 8px;
    background: var(--bg-color, #12101f);
    gap: 6px;
}

.chat-input-area input {
    flex: 1;
    background: var(--surface, #1e1b30);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    padding: 8px;
    border-radius: 6px;
    color: var(--text-color, white);
    font-size: 0.85rem;
}

.chat-input-area button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

@media (max-width: 600px) {
    body { padding: 20px 10px; }
    .card { padding: 18px; }
    .task-row { flex-wrap: wrap; }
    .task-row input[type="text"] { width: 100%; order: 5; }
    .schedule-info-banner, .live-banner { flex-direction: column; align-items: flex-start; }
    .nav-header { gap: 8px; }
    .nav-btn { padding: 6px 8px; font-size: 12px; }
}

.xp-display {
    font-size: 0.8rem;
    color: #f9ca24;
    font-weight: 700;
    margin-right: 14px;
    white-space: nowrap;
}

.xp-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30000;
    animation: xpFadeIn 0.25s ease;
}

@keyframes xpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.xp-popup-content {
    background: linear-gradient(145deg, #1e1a35, #2a2348);
    border: 2px solid var(--accent-color);
    border-radius: 20px;
    padding: 32px 40px;
    text-align: center;
    box-shadow: 0 0 40px rgba(108,92,231,0.4);
    max-width: 340px;
    animation: xpPop 0.35s cubic-bezier(0.18, 1.2, 0.4, 1);
}

@keyframes xpPop {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.xp-popup-emoji { font-size: 3rem; margin-bottom: 8px; }
.xp-popup-title { font-size: 1.4rem; font-weight: 800; color: #fff; margin-bottom: 6px; }
.xp-popup-task { font-size: 0.95rem; color: var(--accent-color); margin-bottom: 12px; }
.xp-popup-gain { font-size: 2rem; font-weight: 900; color: #f9ca24; margin-bottom: 8px; }
.xp-popup-stats { font-size: 0.85rem; color: #b2bec3; margin-bottom: 20px; }

.xp-popup-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
    transition: transform 0.15s, background 0.15s;
}
.xp-popup-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.task-row.active-now {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.task-row.active-now:hover {
    transform: scale(1.025);
    box-shadow: 0 0 18px rgba(0, 206, 201, 0.45);
    border-color: #00cec9;
}

.focus-box {
    max-width: 480px;
    width: 95%;
}

/* Block-detail overlay */
.block-detail-box {
    max-width: 640px;
    width: min(96vw, 640px);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card-bg, #1a1528);
    border: 1px solid var(--border-color, #352a53);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.45);
}
.block-detail-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 6px 4px 10px;
}
.block-detail-times {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 480px) {
    .block-detail-times {
        grid-template-columns: 1fr;
    }
}
.block-detail-times input[type="time"] {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
}
.block-detail-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.block-detail-row label {
    font-size: 0.78rem;
    color: var(--muted-color, #a094b3);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.block-detail-row input[type="text"],
.block-detail-row input[type="time"],
.block-detail-row textarea {
    background: var(--input-bg, #120f1d);
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--text-color, #e2def8);
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
}
.block-detail-row input[type="text"]:focus,
.block-detail-row input[type="time"]:focus,
.block-detail-row textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-light, rgba(108,92,231,0.25));
}
.block-detail-row input[type="time"] {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    line-height: 1.2;
}
.block-detail-row input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
    margin-left: 4px;
}
.block-detail-row textarea {
    resize: vertical;
    min-height: 72px;
}
.bd-done-row {
    margin-top: 2px;
}
.bd-done-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
    text-transform: none !important;
    font-size: 0.92rem !important;
    color: var(--text-color, #e2def8) !important;
    cursor: pointer;
    font-weight: 500 !important;
}
.bd-done-label input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color, #6c5ce7);
}
.bd-micro-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}
.bd-micro-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    font-size: 0.88rem;
}
.bd-micro-item.done span {
    text-decoration: line-through;
    opacity: 0.55;
}
.bd-micro-item span {
    flex: 1;
    min-width: 0;
}
.bd-micro-add {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.bd-micro-add input {
    flex: 1;
    background: var(--input-bg, #120f1d);
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    border-radius: 10px;
    padding: 8px 12px;
    color: var(--text-color);
    font-size: 0.88rem;
    font-family: inherit;
}
.bd-micro-add button {
    width: 36px;
    border: none;
    border-radius: 10px;
    background: var(--accent-color);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.block-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.block-detail-actions .ctrl-btn {
    flex: 1;
    min-width: 140px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--accent-color);
    background: var(--accent-light, rgba(108,92,231,0.2));
    color: var(--text-color, #fff);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
}
.block-detail-actions .ctrl-btn:hover {
    background: var(--accent-color);
    color: #fff;
}

.focus-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.focus-task-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--title-color, #d1baff);
    text-align: center;
}

.focus-timer {
    font-size: 3.8rem;
    font-weight: 800;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    line-height: 1;
}

.focus-phase {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 600;
}

.focus-controls {
    display: flex;
    gap: 10px;
    margin: 6px 0;
}
.focus-controls button {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.focus-ambient {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin: 8px 0;
    font-size: 0.82rem;
    color: #b2bec3;
}

.ambient-btn {
    background: var(--surface, #25213b);
    border: 1px solid var(--border-color, #3d315f);
    color: #ccc;
    padding: 5px 10px;
    border-radius: 16px;
    font-size: 0.78rem;
    cursor: pointer;
}
.ambient-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}
.ambient-btn:hover {
    border-color: var(--accent-color);
}

.focus-micro {
    width: 100%;
    background: transparent;
    border-radius: 0;
    padding: 16px 0 0;
    margin-top: 16px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.1));
    box-sizing: border-box;
}

.focus-micro-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--muted-color, #8f87ae);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-add-micro {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}

#focus-micro-list,
.micro-task-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.micro-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 0.88rem;
    color: var(--text-color, #e0e0e0);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 10px;
}
.micro-item.done span {
    text-decoration: line-through;
    opacity: 0.55;
}
.micro-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
    flex-shrink: 0;
}
.micro-remove {
    background: none;
    border: none;
    color: var(--muted-color, #8f87ae);
    cursor: pointer;
    font-size: 0.85rem;
    margin-left: auto;
    padding: 2px 6px;
}
.micro-remove:hover { color: #e17055; }

.micro-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}
.micro-add-row input,
#focus-micro-input {
    flex: 1;
    width: auto;
    min-width: 0;
    background: var(--input-bg, var(--surface, #1e1b30));
    border: 1px solid var(--border-color, rgba(255,255,255,0.12));
    color: var(--text-color, #fff);
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.88rem;
    box-sizing: border-box;
    font-family: inherit;
}

.music-focus-panel {
    display: flex;
    flex-direction: column;
}

.time-input {
    width: 58px !important;
    min-width: 58px;
    max-width: 72px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.4px;
    color: var(--text-color, #f0ecff);
    background: var(--input-bg, #120f1d);
    border: 1px solid var(--border-color, #352a53);
    border-radius: 8px;
    padding: 8px 6px;
    font-size: 0.88rem;
    font-family: inherit;
}

.todo-section, .timeline-section {
    margin-top: 18px;
    background: var(--bg-color, #171223);
    border: 1px solid var(--border-color, #2d2444);
    border-radius: 10px;
    padding: 12px 14px;
}

.todo-header, .timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--title-color, #d1baff);
    font-size: 0.92rem;
}

.todo-hint {
    font-size: 0.72rem;
    color: var(--muted-color, #8f87ae);
    font-weight: 500;
}

#todo-list {
    list-style: none;
    padding: 0;
    margin: 0 0 10px;
    max-height: 160px;
    overflow-y: auto;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.88rem;
}
.todo-item.done .todo-text {
    text-decoration: line-through;
    opacity: 0.5;
}
.todo-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
    flex-shrink: 0;
}
.todo-text { flex: 1; color: var(--text-color, #e2def8); }
.todo-remove {
    background: none;
    border: none;
    color: #ff6b81;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    opacity: 0.7;
}
.todo-remove:hover { opacity: 1; }
.todo-empty {
    color: var(--muted-color, #6e6a8a);
    font-size: 0.82rem;
    text-align: center;
    padding: 8px;
}

.todo-add-row {
    display: flex;
    gap: 8px;
}
.todo-add-row input {
    flex: 1;
    background: var(--input-bg, #120f1d);
    border: 1px solid var(--border-color, #3d315f);
    color: var(--text-color, #f0ecff);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}
.todo-add-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.timeline-viz {
    position: relative;
    margin-top: 4px;
}

.tl-hours {
    position: relative;
    height: 16px;
    margin-bottom: 2px;
}
.tl-hour-label {
    position: absolute;
    font-size: 0.65rem;
    color: var(--muted-color, #6e6a8a);
    transform: translateX(-50%);
}

.tl-track {
    position: relative;
    height: 42px;
    background: var(--input-bg, #120f1d);
    border-radius: 8px;
    border: 1px solid var(--border-color, #2d2444);
    overflow: hidden;
}

.tl-now {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #ff4757;
    z-index: 5;
    pointer-events: none;
}

.tl-block {
    position: absolute;
    top: 4px;
    bottom: 4px;
    background: var(--accent-color);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    overflow: hidden;
    min-width: 8px;
    transition: filter 0.15s;
    z-index: 2;
}
.tl-block:hover { filter: brightness(1.15); }
.tl-block.tl-dragging { cursor: grabbing; z-index: 10; opacity: 0.9; }
.tl-block.tl-done { opacity: 0.45; }
.tl-block.tl-active {
    box-shadow: 0 0 10px rgba(0,206,201,0.6);
    border: 1px solid #00cec9;
}

.tl-label {
    font-size: 0.68rem;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 6px;
    pointer-events: none;
}

.tl-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    z-index: 3;
}
.tl-handle-left { left: 0; }
.tl-handle-right { right: 0; }
.tl-handle:hover { background: rgba(255,255,255,0.25); }

.xp-popup-rank {
    font-size: 1rem;
    font-weight: 700;
    color: #00cec9;
    margin-bottom: 6px;
}
.xp-bar-wrap {
    width: 100%;
    height: 8px;
    background: var(--input-bg, #120f1d);
    border-radius: 4px;
    overflow: hidden;
    margin: 6px 0 2px;
}
.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #00cec9);
    border-radius: 4px;
    transition: width 0.4s ease;
}
.xp-bar-label {
    font-size: 0.72rem;
    color: var(--muted-color, #8f87ae);
    margin-bottom: 12px;
}

.levelup-toast {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -20px);
    background: linear-gradient(135deg, #6c5ce7, #00cec9);
    color: white;
    padding: 20px 36px;
    border-radius: 16px;
    text-align: center;
    font-weight: 800;
    font-size: 1.2rem;
    z-index: 35000;
    opacity: 0;
    transition: all 0.35s ease;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.levelup-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.levelup-emoji { font-size: 2rem; }
.levelup-rank { font-size: 1.4rem; margin-top: 4px; color: #f9ca24; }

.reward-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--card-bg, #1e1a35);
    border: 2px solid #f9ca24;
    color: #fff;
    padding: 14px 20px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    z-index: 34000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.35s ease;
    max-width: 280px;
    overflow: hidden;
}
.reward-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.reward-toast-timer {
    margin-top: 12px;
    height: 4px;
    width: 100%;
    background: rgba(255,255,255,0.12);
    border-radius: 3px;
    overflow: hidden;
}
.reward-toast-timer-fill {
    height: 100%;
    width: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-color, #6c5ce7), #ffffff);
    box-shadow: 0 0 8px var(--accent-light, rgba(108,92,231,0.4));
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    top: 40%;
    border-radius: 2px;
    animation: confettiFall 1.2s ease forwards;
    pointer-events: none;
}
@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0); opacity: 1; }
    100% { transform: translateY(120px) rotate(360deg); opacity: 0; }
}

.xp-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color, #2d2444);
    border-radius: 20px;
    padding: 4px 10px 4px 8px;
    cursor: pointer;
    margin-left: 10px;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    font-family: inherit;
    color: var(--text-color, #e2def8);
}
.xp-pill:hover {
    border-color: var(--accent-color);
    background: var(--accent-light);
    transform: scale(1.06);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.xp-pill-rank {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-color);
    white-space: nowrap;
}
.xp-pill-bar {
    width: 52px;
    height: 6px;
    background: rgba(0,0,0,0.35);
    border-radius: 3px;
    overflow: hidden;
}
.xp-pill-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), #00cec9);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.xp-pill-pct {
    font-size: 0.68rem;
    color: var(--muted-color, #8f87ae);
    font-weight: 600;
    min-width: 28px;
}
.xp-pill-lost {
    animation: xpShake 0.5s ease;
}
@keyframes xpShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.quick-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.quick-action-btn {
    flex: 1;
    min-width: 140px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color, #3d315f);
    color: var(--text-color, #d1baff);
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.quick-action-btn:hover {
    border-color: var(--accent-color);
    background: var(--accent-light);
}
.todo-count-badge {
    background: var(--accent-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.todo-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 96vw;
    height: 100vh;
    max-height: 100vh;
    box-sizing: border-box;
    background: var(--card-bg, #181528);
    border-left: 1px solid var(--border-color, #2d2444);
    z-index: 15000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: -8px 0 30px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}
.todo-drawer.hidden {
    transform: translateX(100%);
    pointer-events: none;
}
.todo-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    color: var(--text-color);
}
.todo-drawer-hint {
    font-size: 0.78rem;
    color: var(--muted-color, #8f87ae);
    margin: 0 0 12px;
}
.todo-drawer #todo-list {
    flex: 1 1 auto;
    overflow-y: auto;
    list-style: none;
    padding: 0;
    margin: 0 0 12px;
    min-height: 0;
}

.timeline-page {
    position: fixed;
    inset: 0;
    background: var(--bg-color, #120f1d);
    z-index: 16000;
    padding: 24px 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.timeline-page.hidden { display: none; }
.timeline-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.timeline-page-header h2 {
    margin: 0;
    color: var(--accent-color);
    font-size: 1.4rem;
}
.timeline-page-day {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 600;
}
.timeline-page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.timeline-viz-full {
    min-height: 80px;
}
.timeline-viz-full .tl-track {
    height: 64px;
}
.timeline-legend {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    max-width: 500px;
}
.tl-legend-item {
    font-size: 0.85rem;
    color: var(--text-color);
    padding: 6px 10px;
    background: var(--card-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}
.tl-legend-time {
    color: var(--accent-color);
    font-weight: 700;
    margin-right: 8px;
}

.progress-box { max-width: 640px; }
.progress-rank-big {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 4px;
}
.progress-xp-line {
    text-align: center;
    font-size: 0.95rem;
    color: var(--muted-color);
    margin-bottom: 10px;
}
.xp-bar-wrap.big {
    height: 12px;
    margin-bottom: 4px;
}
.progress-streak {
    text-align: center;
    font-size: 0.9rem;
    margin: 10px 0;
    color: #f9ca24;
}
.rewards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
}
.reward-row {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 12px;
}
.reward-row.unlocked {
    border-color: #20bf6b;
}
.reward-row.locked {
    opacity: 0.75;
}
.reward-row-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.reward-name { font-weight: 700; flex: 1; font-size: 0.88rem; }
.reward-req { font-size: 0.72rem; color: var(--muted-color); }
.reward-desc { font-size: 0.78rem; color: var(--muted-color); margin-bottom: 4px; }
.xp-bar-wrap.small { height: 5px; margin: 4px 0 2px; }
.reward-prog { font-size: 0.7rem; color: var(--muted-color); }

.swatch-locked {
    opacity: 0.45;
    cursor: not-allowed !important;
    font-size: 0.7rem;
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.swatch-active {
    outline: 2px solid #fff;
    outline-offset: 2px;
    transform: scale(1.12);
}
.theme-hint {
    font-size: 0.72rem;
    color: var(--muted-color);
    margin: 6px 0 0;
}

.todo-section, .timeline-section { display: none !important; }
.xp-display { display: none !important; }

.top-status-bar {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 5000;
    display: flex;
    align-items: center;
    gap: 8px;
}
.xp-pill-fixed {
    position: relative !important;
    top: auto;
    left: auto;
    z-index: 1;
    margin: 0 !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    backdrop-filter: blur(10px);
    background: var(--card-bg, #1a1528) !important;
    padding: 10px 16px !important;
    gap: 12px !important;
    border-radius: 28px !important;
    border: 2px solid var(--accent-color) !important;
    color: var(--text-color, #e2def8);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s, background 0.3s;
}
.xp-pill-fixed:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.5);
    border-color: var(--accent-hover, var(--accent-color)) !important;
}
.xp-pill-fixed .xp-pill-rank {
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.3px;
    color: var(--accent-color) !important;
}
.xp-pill-fixed .xp-pill-bar {
    width: 140px !important;
    height: 12px !important;
    background: rgba(255,255,255,0.12) !important;
    border-radius: 5px !important;
    overflow: hidden !important;
    display: block !important;
}
.xp-pill-fixed .xp-pill-fill {
    display: block !important;
    height: 100% !important;
    background: linear-gradient(90deg, var(--accent-color), #00cec9) !important;
    border-radius: 5px;
    transition: width 0.4s ease;
}
.xp-pill-fixed .xp-pill-pct {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    min-width: 48px;
    color: var(--muted-color, #8f87ae) !important;
    white-space: nowrap;
}

.theme-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
}

.lock-badge {
    font-size: 0.75rem;
    margin-left: 4px;
}
.btn-locked {
    opacity: 0.55;
    position: relative;
}
.btn-locked::after {
    content: " 🔒";
}

.timeline-viz-vertical {
    overflow: auto;
    max-height: calc(100vh - 140px);
}
.tl-vertical-wrap {
    display: flex;
    position: relative;
    min-height: 1152px;
}
.tl-gutter {
    width: 56px;
    flex-shrink: 0;
    position: relative;
}
.tl-vhour {
    position: absolute;
    left: 0;
    font-size: 0.7rem;
    color: var(--muted-color, #6e6a8a);
    transform: translateY(-50%);
    width: 50px;
    text-align: right;
    padding-right: 8px;
}
.tl-vtrack {
    flex: 1;
    position: relative;
    background: var(--card-bg, #1a1528);
    border: 1px solid var(--border-color, #2d2444);
    border-radius: 10px;
    margin-left: 4px;
}
.tl-hline {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255,255,255,0.06);
}
.tl-vnow {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #ff4757;
    z-index: 8;
    pointer-events: none;
}
.tl-vnow::before {
    content: "";
    position: absolute;
    left: -5px;
    top: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4757;
}
.tl-vblock {
    position: absolute;
    left: 8px;
    right: 8px;
    background: var(--accent-color);
    border-radius: 8px;
    padding: 4px 10px;
    cursor: grab;
    overflow: hidden;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    transition: filter 0.15s;
}
.tl-vblock:hover { filter: brightness(1.12); }
.tl-vblock.tl-dragging { cursor: grabbing; z-index: 10; opacity: 0.9; }
.tl-vblock.tl-done { opacity: 0.45; }
.tl-vblock.tl-active {
    box-shadow: 0 0 12px rgba(0,206,201,0.5);
    border: 1px solid #00cec9;
}
.tl-vlabel {
    display: flex;
    flex-direction: column;
    gap: 1px;
    pointer-events: none;
    font-size: 0.78rem;
    color: #fff;
    line-height: 1.25;
}
.tl-vlabel strong { font-size: 0.72rem; opacity: 0.9; }
.tl-vhandle {
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    z-index: 4;
}
.tl-vhandle-top { top: 0; }
.tl-vhandle-bot { bottom: 0; }
.tl-vhandle:hover { background: rgba(255,255,255,0.2); }

.quick-actions {
    margin-bottom: 14px;
    margin-top: 4px;
}

.progress-box {
    max-width: 680px !important;
    max-height: 90vh;
    overflow-y: auto;
}
.ranks-hint {
    font-size: 0.75rem;
    color: var(--muted-color, #8f87ae);
    margin: 0 0 8px;
}
.ranks-ladder {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 6px;
}
.rank-row {
    display: grid;
    grid-template-columns: 22px 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 5px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
}
.rank-row.rank-done {
    color: #20bf6b;
    background: rgba(32,191,107,0.08);
}
.rank-row.rank-current {
    color: #fff;
    background: var(--accent-light);
    border: 1px solid var(--accent-color);
    font-weight: 700;
}
.rank-row.rank-locked {
    color: var(--muted-color, #6e6a8a);
    opacity: 0.7;
}
.rank-icon { text-align: center; font-weight: 800; }
.rank-name { font-weight: 600; }
.rank-cost { color: var(--muted-color); font-size: 0.72rem; }
.rank-cum { color: var(--muted-color); font-size: 0.72rem; min-width: 70px; text-align: right; }

.progress-rank-big {
    font-size: 1.85rem !important;
    font-weight: 900 !important;
    letter-spacing: 0.5px;
}

.timeline-page-body {
    display: flex;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.timeline-page-body .timeline-viz {
    flex: 1;
    min-width: 0;
    max-height: calc(100vh - 130px);
    overflow-y: auto;
}
.timeline-side {
    width: 280px;
    flex-shrink: 0;
    background: var(--card-bg, #1a1528);
    border: 1px solid var(--border-color, #2d2444);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 130px);
}
.timeline-side-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: var(--text-color);
}
.timeline-legend {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: none;
}
.tl-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    padding: 8px 10px;
}
.tl-legend-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tl-legend-del {
    background: none;
    border: none;
    color: #ff6b81;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 6px;
    opacity: 0.7;
}
.tl-legend-del:hover { opacity: 1; }

.tl-vlabel {
    font-size: 0.85rem !important;
    padding: 2px 0;
}
.tl-vlabel strong {
    font-size: 0.8rem !important;
}

@media (max-width: 800px) {
    .timeline-page-body { flex-direction: column; }
    .timeline-side { width: 100%; max-height: 200px; }
}

.app-bio {
    margin-top: 22px;
    padding: 16px 18px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color, #2d2444);
    border-radius: 12px;
    border-left: 3px solid var(--accent-color);
}
.app-bio-title {
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
    color: var(--accent-color);
    margin-bottom: 10px;
}
.app-bio p {
    margin: 0 0 8px;
    font-size: 0.84rem;
    line-height: 1.6;
    font-weight: 650;
    color: var(--muted-color, #8f87ae) !important;
}
.app-bio p:last-child { margin-bottom: 0; }
.app-bio em {
    color: var(--accent-color, #a29bfe) !important;
    font-style: normal;
    font-weight: 700;
}

.theme-swatches {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}
.theme-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color, #3d315f);
    border-radius: 10px;
    padding: 8px 10px 6px;
    cursor: pointer;
    min-width: 64px;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    font-family: inherit;
    color: var(--text-color, #e2def8);
}
.theme-chip:hover:not(.theme-chip-locked) {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    background: var(--accent-light);
}
.theme-chip-active {
    border-color: var(--accent-color) !important;
    background: var(--accent-light) !important;
    box-shadow: 0 0 0 1px var(--accent-color);
}
.theme-chip-locked {
    opacity: 0.5;
    cursor: not-allowed;
}
.theme-chip-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.theme-chip-label {
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.theme-hint {
    font-size: 0.72rem;
    color: var(--muted-color);
    margin: 8px 0 0;
}

.leveldown-card {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    opacity: 0;
    transition: opacity 0.25s;
}
.leveldown-card.show { opacity: 1; }
.leveldown-inner {
    background: var(--card-bg, #1a1528);
    border: 2px solid #e17055;
    border-radius: 16px;
    padding: 28px 32px;
    max-width: 360px;
    text-align: center;
    color: var(--text-color, #e2def8);
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.leveldown-emoji { font-size: 2.4rem; margin-bottom: 8px; }
.leveldown-title {
    font-size: 1.4rem;
    font-weight: 900;
    color: #e17055;
    margin-bottom: 10px;
}
.leveldown-body {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 8px;
}
.leveldown-hint {
    font-size: 0.8rem;
    color: var(--muted-color);
    margin-bottom: 16px;
}

.sync-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--card-bg, #1a1528);
    border: 2px solid var(--border-color);
    color: var(--text-color);
    padding: 14px 22px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    z-index: 2147483646 !important;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-width: min(420px, 92vw);
    text-align: center;
    pointer-events: none;
}
.sync-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.sync-toast.toast-warn { border-color: #e17055; }
.sync-toast.toast-info { border-color: var(--accent-color); }

.chime-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chime-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color, #3d315f);
    border-radius: 10px;
    padding: 8px 10px 6px;
    cursor: pointer;
    min-width: 64px;
    font-family: inherit;
    color: var(--text-color);
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.chime-chip:hover:not(.chime-chip-locked) {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    background: var(--accent-light);
}
.chime-chip-active {
    border-color: var(--accent-color) !important;
    background: var(--accent-light) !important;
    box-shadow: 0 0 0 1px var(--accent-color);
}
.chime-chip-locked {
    opacity: 0.45;
    cursor: not-allowed;
}
.chime-chip-icon { font-size: 1.1rem; }
.chime-chip-label {
    font-size: 0.68rem;
    font-weight: 600;
}

.theme-pick-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}
.theme-pick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 10px;
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.theme-pick-btn:hover {
    border-color: var(--accent-color);
    background: var(--accent-light);
}
.theme-pick-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.preset-io-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.preset-io-row button {
    flex: 1;
    min-width: 120px;
    font-size: 0.8rem;
    padding: 8px 10px;
}

.review-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.review-stat {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
}
.review-stat-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-color);
}
.review-stat-label {
    font-size: 0.7rem;
    color: var(--muted-color);
    margin-top: 4px;
    font-weight: 600;
}
.review-summary {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color);
    margin-bottom: 4px;
}
.review-days {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.review-day-row {
    display: grid;
    grid-template-columns: 48px 1fr 70px;
    gap: 8px;
    align-items: center;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 8px;
}
.review-day-row.review-best {
    background: var(--accent-light);
    border: 1px solid var(--accent-color);
}
.review-day-row.review-weak {
    background: rgba(255, 100, 100, 0.08);
    border: 1px solid rgba(255, 100, 100, 0.25);
}
.review-day-name { font-weight: 700; }
.review-day-stats {
    text-align: right;
    color: var(--muted-color);
    font-size: 0.72rem;
}
.review-verdict {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border-left: 3px solid var(--accent-color);
    line-height: 1.4;
}
.review-section-title {
    margin: 16px 0 8px;
    font-size: 0.85rem;
    color: var(--muted-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.review-cats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.review-cat-row {
    display: grid;
    grid-template-columns: 1fr 1fr 50px;
    gap: 8px;
    align-items: center;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 8px;
}
.review-cat-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-page {
    position: fixed;
    inset: 0;
    z-index: 7000;
    background: var(--bg-color, #120f1d);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    padding: 20px 24px 90px;
    overflow-y: auto;
}
.music-page.hidden { display: none; }
.music-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
    gap: 12px;
}
.music-page-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--accent-color);
}
.music-page-sub {
    margin: 4px 0 0;
    font-size: 0.85rem;
    color: var(--muted-color);
}
.music-page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    flex: 1;
}
.music-panel {
    background: var(--card-bg, #1a1528);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 16px 18px;
}
.music-panel h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    color: var(--heading-color, var(--accent-color));
}
.music-hint {
    margin: 0 0 12px;
    font-size: 0.75rem;
    color: var(--muted-color);
}
.music-search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.music-search-input {
    flex: 1;
    background: var(--input-bg, #120f1d);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9rem;
}
.music-search-results {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.music-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.msi-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.msi-meta strong {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msi-meta span {
    font-size: 0.72rem;
    color: var(--muted-color);
}
.music-focus-panel .focus-timer {
    font-size: 2.8rem;
    font-weight: 900;
    text-align: center;
    margin: 8px 0;
    font-variant-numeric: tabular-nums;
    color: var(--text-color);
}
.music-focus-panel .focus-task-name {
    text-align: center;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 4px;
}
.music-focus-panel .focus-phase {
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted-color);
    margin-bottom: 10px;
}
.music-focus-panel .focus-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.music-focus-panel .focus-controls button {
    background: var(--surface, #231b36);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 10px;
    padding: 8px 14px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}
.music-focus-panel .focus-controls button:first-child {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.music-ambient-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.music-ambient-row .ambient-btn {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.music-ambient-row .ambient-btn.active {
    border-color: var(--accent-color);
    background: var(--accent-light);
    color: var(--accent-color);
    font-weight: 700;
}
.music-local-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.music-track-label {
    font-size: 0.8rem;
    color: var(--muted-color);
}

.now-playing-bar {
    position: fixed;
    bottom: 16px;
    right: 16px;
    left: auto;
    z-index: 6500;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg, #1a1528);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 10px 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.4);
    max-width: min(380px, calc(100vw - 32px));
    color: var(--text-color);
}
.now-playing-bar.hidden { display: none; }
.np-info { min-width: 0; flex: 1; }
.np-title {
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.np-artist {
    font-size: 0.75rem;
    color: var(--muted-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.np-time {
    font-size: 0.7rem;
    color: var(--muted-color);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}
.np-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.np-controls button {
    background: var(--accent-color);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.np-controls .np-open {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}
#np-volume {
    width: 70px;
    accent-color: var(--accent-color);
}

@media (max-width: 600px) {
    .music-page { padding: 14px 12px 100px; }
    .review-hero { grid-template-columns: repeat(2, 1fr); }
}

.music-page-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.local-track-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 280px;
    overflow-y: auto;
}
.local-track-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.local-track-item.playing {
    border-color: var(--accent-color);
    background: var(--accent-light);
}
.local-track-name {
    flex: 1;
    min-width: 0;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.local-track-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.btn-sm {
    padding: 6px 10px !important;
    font-size: 0.78rem !important;
    min-width: 36px;
}

.focus-micro {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}
.focus-micro-header {
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.micro-task-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}
.micro-task-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.85rem;
}
.micro-task-list li input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}
.micro-add-row {
    display: flex;
    gap: 8px;
}
.micro-add-row input {
    flex: 1;
    background: var(--input-bg, #120f1d);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.85rem;
}
.btn-add-micro {
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.music-focus-panel .focus-micro {
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 16px 0 0 !important;
    margin-top: 16px !important;
    border-top: 1px solid var(--border-color) !important;
    max-height: none !important;
    overflow: visible !important;
}
.music-focus-panel #focus-micro-list,
.music-focus-panel .micro-task-list {
    max-height: none !important;
    overflow: visible !important;
}

.msi-art {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.06);
}
.msi-art-ph {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-color);
    font-size: 1rem;
}
.music-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-block-wrap {
    margin-bottom: 6px;
}
.task-row {
    position: relative;
}
.micro-toggle {
    flex-shrink: 0;
    width: 22px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--muted-color);
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0.35;
    border-radius: 6px;
    padding: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.task-row:hover .micro-toggle,
.micro-toggle:focus {
    opacity: 1;
    color: var(--accent-color);
    background: var(--accent-light, rgba(108,92,231,0.2));
}
.block-focus-btn {
    flex-shrink: 0;
    width: 30px;
    height: 28px;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0.4;
    transition: opacity 0.15s, background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.task-row:hover .block-focus-btn,
.task-row.active-now .block-focus-btn {
    opacity: 1;
}
.task-row.active-now .block-focus-btn {
    border-color: var(--accent-color);
    background: var(--accent-light, rgba(108,92,231,0.25));
}
.micro-panel {
    display: none;
    margin: 0 8px 8px 28px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px dashed var(--border-color);
    background: rgba(0,0,0,0.18);
}
.micro-panel.open {
    display: block;
}
.block-micro-list {
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
}
.block-micro-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.85rem;
}
.block-micro-item.done span {
    text-decoration: line-through;
    opacity: 0.55;
}
.block-micro-item span {
    flex: 1;
}
.block-micro-add {
    display: flex;
    gap: 6px;
}
.block-micro-add input {
    flex: 1;
    background: var(--input-bg, var(--bg-color));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    padding: 6px 10px;
    font-size: 0.85rem;
}
.block-micro-add button {
    border: none;
    background: var(--accent-color);
    color: #fff;
    border-radius: 8px;
    width: 32px;
    cursor: pointer;
    font-weight: 700;
}

.xp-pill.rank-mythic,
body.rank-mythic .xp-pill {
    box-shadow: 0 0 16px rgba(180,120,255,0.55), 0 0 4px rgba(255,200,100,0.4);
    border-color: #c9a0ff;
}
.xp-pill.rank-legend,
body.rank-legend .xp-pill {
    box-shadow: 0 0 12px rgba(255,180,60,0.45);
}
.xp-pill.rank-master,
body.rank-master .xp-pill {
    box-shadow: 0 0 10px rgba(100,200,255,0.35);
}
body.rank-mythic .app-title::after {
    content: " ✦";
    color: #c9a0ff;
}
body.fx-complete .task-row.completed {
    animation: completePulse 0.55s ease;
}
@keyframes completePulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.02); box-shadow: 0 0 0 2px var(--accent-color); }
    100% { transform: scale(1); }
}

.clock-skin-starter .flap-card { border-radius: 4px; }
.clock-skin-beginner .flap-card {
    box-shadow: 0 0 6px rgba(108,92,231,0.25);
}
.clock-skin-skilled .flap-card {
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 8px var(--accent-light, rgba(108,92,231,0.3));
}
.clock-skin-expert .flap-card {
    border: 1px solid #f9ca24;
    box-shadow: 0 0 10px rgba(249,202,36,0.35);
}
#preset-sidebar.skin-amateur {
    border-left: 3px solid var(--accent-color);
}
#preset-sidebar.skin-expert {
    border-left: 3px solid #00cec9;
    box-shadow: inset 0 0 24px rgba(0,206,201,0.08);
}
#preset-sidebar.skin-mythic {
    border-left: 3px solid #c9a0ff;
    box-shadow: inset 0 0 30px rgba(180,120,255,0.12);
}

.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 30% 20%, #2a1f4a 0%, #120f1d 55%, #0a0812 100%);
    padding: 20px;
}
.auth-screen.hidden {
    display: none;
}
.auth-card {
    width: min(400px, 100%);
    background: rgba(30, 24, 48, 0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 32px 28px 28px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.auth-logo {
    font-size: 2.4rem;
    text-align: center;
    margin-bottom: 8px;
}
.auth-title {
    text-align: center;
    margin: 0 0 6px;
    font-size: 1.6rem;
    color: #f0ecff;
}
.auth-sub {
    text-align: center;
    margin: 0 0 20px;
    font-size: 0.88rem;
    color: #9b92b8;
}
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 18px;
    background: rgba(0,0,0,0.25);
    padding: 4px;
    border-radius: 12px;
}
.auth-tab {
    border: none;
    background: transparent;
    color: #9b92b8;
    padding: 10px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.auth-tab.active {
    background: var(--accent-color, #6c5ce7);
    color: #fff;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.auth-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #9b92b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.auth-label input {
    background: #120f1d;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 12px 14px;
    color: #f0ecff;
    font-size: 0.95rem;
    font-family: inherit;
}
.auth-label input:focus {
    outline: none;
    border-color: var(--accent-color, #6c5ce7);
}
.auth-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,80,100,0.15);
    color: #ff8a9a;
    font-size: 0.85rem;
}
.auth-error.hidden { display: none; }
.auth-submit {
    margin-top: 4px;
    margin-left: 18px; /* nudge Google button a bit to the right */
    border: none;
    border-radius: 12px;
    padding: 14px;
    background: var(--accent-color, #6c5ce7);
    color: #fff;
    font-weight: 800;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 18px);
    box-sizing: border-box;
}
.auth-submit:hover { filter: brightness(1.08); }
.auth-submit:disabled { opacity: 0.6; cursor: wait; }

/* —— Local offline account under Google —— */
.local-auth-wrap {
    margin-top: 14px;
    width: 100%;
}
.auth-or {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 12px;
    color: #7a7198;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.auth-or::before,
.auth-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.1);
}
.auth-local-toggle {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.14);
    background: transparent;
    color: #cfc6e8;
    border-radius: 12px;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
}
.auth-local-toggle:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.22);
}
.local-auth-wrap .auth-form {
    margin-top: 14px;
}
.local-auth-wrap .auth-form.hidden {
    display: none;
}
.auth-local-submit {
    margin-left: 0 !important;
    width: 100% !important;
}
.local-auth-wrap .auth-hint code {
    font-size: 0.72rem;
    color: #a89cc8;
}

.auth-hint {
    margin: 16px 0 0;
    font-size: 0.78rem;
    color: #7a7198;
    text-align: center;
    line-height: 1.4;
}
.profile-chip {
    margin: 0;
    border: 2px solid var(--accent-color, #6c5ce7);
    background: var(--card-bg, #1a1528);
    color: var(--accent-color, #6c5ce7);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0;
    text-transform: uppercase;
}
.profile-chip:hover {
    border-color: var(--accent-hover, var(--accent-color));
    transform: scale(1.08);
}
.profile-chip.hidden {
    display: none !important;
}
.calendar-btn {
    margin: 0;
    border: 2px solid var(--accent-color, #6c5ce7);
    background: var(--card-bg, #1a1528);
    color: var(--text-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    font-size: 1.1rem;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, border-color 0.2s;
}
.calendar-btn:hover {
    border-color: var(--accent-hover, var(--accent-color));
    transform: scale(1.08);
}
.profile-menu {
    position: fixed;
    z-index: 9000;
    min-width: 200px;
    background: var(--card-bg, #1a1528);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.profile-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--text-color);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.88rem;
}
.profile-menu button:hover {
    background: var(--accent-light, rgba(108,92,231,0.2));
}
body.auth-locked .card,
body.auth-locked #top-status-bar,
body.auth-locked #xp-pill,
body.auth-locked #preset-sidebar,
body.auth-locked #now-playing-bar,
body.auth-locked .music-page,
body.auth-locked .modal-overlay {
    visibility: hidden !important;
    pointer-events: none !important;
}

.preset-hidden-section {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color, #352a53);
}
.preset-hidden-label {
    margin: 0 0 8px;
    font-size: 0.72rem;
    color: var(--muted-color, #8f87ae);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
}
.preset-item-row.preset-item-hidden {
    opacity: 0.75;
}


/* ===== Calendar page ===== */
.calendar-page {
    position: fixed; inset: 0;
    background: var(--bg-color, #120f1d);
    z-index: 17000;
    padding: 20px 28px;
    overflow: hidden;
    display: flex; flex-direction: column; gap: 12px;
}
.calendar-page.hidden { display: none; }
.calendar-page-header {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
}
.calendar-page-header h2 { margin: 0; color: var(--accent-color); font-size: 1.35rem; }
.calendar-page-sub { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted-color); }

.calendar-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr;
    gap: 16px;
    flex: 1;
    min-height: 0;
}
.calendar-left, .calendar-right {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px;
    overflow: auto;
    min-height: 0;
}
.calendar-left {
    overflow: visible;
}
.cal-nav {
    display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 12px;
}
.cal-year-label { font-size: 1.1rem; font-weight: 800; color: var(--accent-color); min-width: 160px; text-align: center; }
.cal-month-single {
    width: 100%;
}
.cal-month {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 12px 16px;
    overflow: visible;
    box-sizing: border-box;
}
.cal-month-title { display: none; } /* month name is in nav */
.cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 4px; margin-bottom: 6px;
}
.cal-weekdays span {
    text-align: center; font-size: 0.75rem; color: var(--muted-color); font-weight: 700;
}
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
}
.cal-days {
    overflow: visible;
}
.cal-month {
    overflow: visible;
}
.cal-day {
    aspect-ratio: 1;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.85rem;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    font-weight: 600;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 0;
    margin: 0;
    line-height: 1;
}
.cal-day:hover { background: var(--accent-light, rgba(108,92,231,0.25)); }
.cal-day.other-month { opacity: 0.22; pointer-events: none; }
.cal-day.today {
    box-shadow: inset 0 0 0 2px var(--accent-color);
    font-weight: 800;
}
.cal-day.selected {
    background: var(--accent-color);
    color: #fff;
    font-weight: 800;
    box-shadow: none;
    z-index: 1;
}
.cal-day.has-events::after {
    content: "";
    position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--accent-color);
}
.cal-day.selected.has-events::after { background: #fff; }
.cal-day-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px;
}
.cal-day-header h3 { margin: 0; font-size: 1.05rem; color: var(--text-color); }

/* Horizontal Gantt-style day visualizer */
.cal-day-timeline.cal-gantt {
    position: relative;
    min-height: 0;
    height: auto;
    background: var(--bg-color);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    overflow: auto;
    padding: 0;
}
.cal-gantt-inner {
    min-width: 560px;
    display: flex;
    flex-direction: column;
}
.cal-gantt-hours {
    display: grid;
    grid-template-columns: 120px repeat(16, 1fr);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 2;
}
.cal-gantt-hours span {
    font-size: 0.65rem;
    color: var(--muted-color);
    text-align: center;
    padding: 6px 0;
    border-left: 1px solid var(--border-color);
}
.cal-gantt-hours span:first-child {
    border-left: none;
    text-align: left;
    padding-left: 8px;
    font-weight: 700;
}
.cal-gantt-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    min-height: 36px;
    border-bottom: 1px solid var(--border-color);
    align-items: stretch;
}
.cal-gantt-label {
    font-size: 0.75rem;
    color: var(--text-color);
    padding: 6px 8px;
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-right: 1px solid var(--border-color);
    font-weight: 600;
}
.cal-gantt-track {
    position: relative;
    background: repeating-linear-gradient(
        to right,
        transparent,
        transparent calc(100% / 16 - 1px),
        var(--border-color) calc(100% / 16 - 1px),
        var(--border-color) calc(100% / 16)
    );
}
.cal-gantt-bar {
    position: absolute;
    top: 6px;
    bottom: 6px;
    background: var(--accent-color);
    color: #fff;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0 6px;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    opacity: 0.92;
}
.cal-gantt-bar:hover { opacity: 1; }
.cal-gantt-empty {
    padding: 20px;
    text-align: center;
    color: var(--muted-color);
    font-size: 0.85rem;
}

.cal-events-list { display: flex; flex-direction: column; gap: 8px; }
.cal-event-card {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 10px; padding: 10px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.cal-event-card strong { color: var(--accent-color); }
.cal-event-meta { font-size: 0.78rem; color: var(--muted-color); }
.cal-event-actions { display: flex; gap: 6px; }
.cal-field-label { display: block; font-size: 0.8rem; color: var(--muted-color); margin: 10px 0 4px; }
.cal-time-row { display: flex; gap: 12px; }
.cal-time-row > div { flex: 1; }
.btn-sm { padding: 6px 12px !important; font-size: 0.82rem !important; }

@media (max-width: 900px) {
    .calendar-layout { grid-template-columns: 1fr; }
}

/* Todo improvements */
.todo-add-row-ext {
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    flex-shrink: 0;
    padding-bottom: 4px;
    margin-top: auto;
}
.todo-add-row-ext #todo-input { flex: 1 1 140px; min-width: 0; }
.todo-add-row-ext .todo-due-input { flex: 0 0 auto; max-width: 140px; }
.todo-add-row-ext .todo-add-btn { flex-shrink: 0; }
.todo-due-input {
    background: var(--input-bg, var(--bg-color));
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.85rem;
}
.todo-item .todo-due {
    font-size: 0.72rem;
    color: var(--muted-color);
    margin-left: 6px;
    white-space: nowrap;
}
.todo-item .todo-due.overdue { color: #ff7675; font-weight: 700; }
.todo-item .todo-due.due-soon { color: #fdcb6e; }
.todo-drawer #todo-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    max-height: none;
}

/* XP pill mid + divisions */
.xp-pill-mid {
    display: flex; flex-direction: row; align-items: center; gap: 0;
    position: relative;
}
.xp-pill-mid .xp-pill-bar {
    position: relative;
}
.xp-pill-divisions {
    display: none; /* ticks drawn on the bar via box-shadow / overlay */
}
.xp-pill-bar {
    position: relative;
}
.xp-pill-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to right,
        transparent 0,
        transparent calc(20% - 1px),
        rgba(255,255,255,0.22) calc(20% - 1px),
        rgba(255,255,255,0.22) 20%
    );
    pointer-events: none;
    border-radius: inherit;
}
.xp-pill-fixed .xp-pill-bar {
    width: 160px !important;
}

/* App customiser */
.customiser-box { max-width: 560px !important; }
.customiser-toggles { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.toggle-row {
    display: flex; align-items: center; gap: 12px;
    font-size: 0.92rem; color: var(--text-color); cursor: pointer;
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
}
.toggle-row input[type="checkbox"] {
    width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent-color);
}
.toggle-row span { flex: 1; line-height: 1.3; }
.cosmetics-list { display: flex; flex-direction: column; gap: 8px; }
.cosmetic-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.cosmetic-row.locked { opacity: 0.55; }
.cosmetic-row .cos-name { font-weight: 700; color: var(--text-color); }
.cosmetic-row .cos-desc { font-size: 0.78rem; color: var(--muted-color); }
.cosmetic-row .cos-badge {
    font-size: 0.72rem; font-weight: 700;
    padding: 3px 8px; border-radius: 999px;
    background: var(--accent-light); color: var(--accent-color);
}
.cosmetic-row .cos-badge.unlocked-badge {
    background: rgba(0,184,148,0.2); color: #00b894;
}

/* Overdue modal */
#overdue-penalty-body { font-size: 0.92rem; line-height: 1.5; color: var(--text-color); }
#overdue-penalty-body .penalty-item {
    padding: 8px 10px; margin: 6px 0;
    background: var(--bg-color); border-radius: 8px;
    border-left: 3px solid #ff7675;
}

@media (max-width: 900px) {
    .calendar-layout { grid-template-columns: 1fr; }
    .cal-year-grid { grid-template-columns: repeat(2, 1fr); }
}


/* Calendar urgency */
.calendar-btn { position: relative; }
.calendar-btn.has-urgent::after {
    content: "!";
    position: absolute;
    top: -4px; right: -4px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #ff4757;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
    box-shadow: 0 0 0 2px var(--card-bg, #1a1528);
}
.calendar-btn.shiver {
    animation: calShiver 0.45s ease-in-out infinite;
}
@keyframes calShiver {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-2px) rotate(-4deg); }
    75% { transform: translateX(2px) rotate(4deg); }
}

/* Missed calendar event popup (same family as xp-popup) */
.missed-event-popup {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex; align-items: center; justify-content: center;
    z-index: 2147483000;
}
.missed-event-popup .xp-popup-content { max-width: 420px; text-align: center; }
.missed-event-actions {
    display: flex; flex-direction: column; gap: 8px; margin-top: 14px;
}
.missed-event-actions button {
    font-family: inherit; font-weight: 700; cursor: pointer;
    border-radius: 10px; padding: 10px 14px; border: none;
}
.missed-event-actions .btn-yes {
    background: #00b894; color: #fff;
}
.missed-event-actions .btn-resched {
    background: var(--accent-color, #6c5ce7); color: #fff;
}
.missed-event-actions .btn-del {
    background: transparent; color: var(--muted-color);
    border: 1px solid var(--border-color) !important;
}


/* Preset delete compact row */
.preset-delete-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}
.preset-delete-row select {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}
.sidebar-group-compact select,
.sidebar-group select {
    max-width: 100%;
    box-sizing: border-box;
}
.sidebar-content {
    overflow-x: hidden;
    overflow-y: auto;
    max-width: 100%;
    box-sizing: border-box;
}
.preset-sidebar .sidebar-group {
    max-width: 100%;
    box-sizing: border-box;
}
.preset-sidebar .btn-danger,
.preset-sidebar .btn-warning,
.preset-sidebar .btn-primary {
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
}

/* Progress ranks: wider horizontal feel */
.ranks-ladder {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    max-height: 280px;
    overflow-y: auto;
}
.progress-box {
    max-width: 720px !important;
    width: min(720px, 96vw);
}

.xp-pill-bar-divided {
    position: relative !important;
    overflow: hidden !important;
}
.xp-pill-bar-divided::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to right,
        transparent 0,
        transparent calc(20% - 1px),
        rgba(255,255,255,0.25) calc(20% - 1px),
        rgba(255,255,255,0.25) 20%
    );
    pointer-events: none;
    border-radius: inherit;
    z-index: 1;
}
.xp-pill-bar-divided .xp-pill-fill {
    position: relative;
    z-index: 0;
}


/* Add Event modal — themed */
.cal-event-box {
    max-width: 440px !important;
    width: min(440px, 94vw);
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color);
}
.cal-event-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cal-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--input-bg, var(--bg-color)) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-color) !important;
    border-radius: 10px;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s;
    color-scheme: dark;
}
.cal-input:focus {
    border-color: var(--accent-color) !important;
}
.cal-textarea {
    resize: vertical;
    min-height: 72px;
}
.cal-time-row {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}
.cal-time-row > div {
    flex: 1;
    min-width: 0;
}
.cal-field-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted-color);
    margin: 10px 0 4px;
}

/* Pure timeline gantt improvements */
.cal-day-timeline.cal-gantt {
    flex: 1;
    min-height: 220px;
    max-height: none;
    height: auto;
    display: flex;
    flex-direction: column;
}
.calendar-right {
    display: flex;
    flex-direction: column;
}
.cal-gantt-inner {
    min-width: 640px;
    flex: 1;
}
.cal-gantt-hours {
    display: grid;
    grid-template-columns: 140px repeat(16, minmax(36px, 1fr));
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 2;
}
.cal-gantt-hours span {
    font-size: 0.7rem;
    color: var(--muted-color);
    text-align: center;
    padding: 8px 0;
    border-left: 1px solid var(--border-color);
    font-weight: 600;
}
.cal-gantt-hours span:first-child {
    border-left: none;
    text-align: left;
    padding-left: 10px;
}
.cal-gantt-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    min-height: 44px;
    border-bottom: 1px solid var(--border-color);
}
.cal-gantt-label {
    font-size: 0.8rem;
    color: var(--text-color);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}
.cal-gantt-label strong {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--accent-color);
}
.cal-gantt-label small {
    font-size: 0.68rem;
    color: var(--muted-color);
}
.cal-gantt-track {
    position: relative;
    background:
        repeating-linear-gradient(
            to right,
            transparent 0,
            transparent calc(100% / 16 - 1px),
            rgba(255,255,255,0.06) calc(100% / 16 - 1px),
            rgba(255,255,255,0.06) calc(100% / 16)
        );
}
.cal-gantt-bar {
    position: absolute;
    top: 8px;
    bottom: 8px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover, var(--accent-color)));
    color: #fff;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    min-width: 48px;
}
.cal-gantt-bar:hover {
    filter: brightness(1.08);
}
.cal-gantt-bar .gantt-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.cal-gantt-bar:hover .gantt-actions {
    opacity: 1;
}
.cal-gantt-bar .gantt-actions button {
    border: none;
    background: rgba(0,0,0,0.35);
    color: #fff;
    border-radius: 4px;
    font-size: 0.65rem;
    padding: 2px 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
}
.cal-gantt-bar .gantt-actions button:hover {
    background: rgba(0,0,0,0.55);
}
.cal-gantt-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--muted-color);
    font-size: 0.9rem;
}


.cal-gantt-row.cal-gantt-clickable {
    cursor: pointer;
}
.cal-gantt-row.cal-gantt-clickable:hover {
    background: rgba(255,255,255,0.03);
}
.cal-gantt-row .cal-gantt-label .row-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}
.cal-gantt-row .cal-gantt-label .row-actions button {
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    border-radius: 6px;
    font-size: 0.68rem;
    padding: 2px 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}
.cal-gantt-row .cal-gantt-label .row-actions button:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.cal-gantt-row .cal-gantt-label .row-actions button.danger:hover {
    border-color: #ff7675;
    color: #ff7675;
}
