/* ================================================
   STYLE.CSS — Todo App (Light Dashboard Theme)
   ================================================ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600&family=IBM+Plex+Sans+KR:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Lora:wght@400;500;600;700&family=Nanum+Gothic:wght@400;700&family=Noto+Sans+KR:wght@400;500;600;700&family=Noto+Serif+KR:wght@400;500;600;700&family=Roboto+Mono:wght@400;500;600&display=swap');
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

/* === RESET & VARIABLES === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --bg:       #f5f5f7;
    --surface:  #ffffff;
    --border:   #e5e7eb;

    --text-1:   #111827;
    --text-2:   #6b7280;
    --text-3:   #9ca3af;

    --black:    #0f172a;
    --blue:     #2563eb;
    --green:    #10b981;
    --red:      #ef4444;
    --purple:   #8b5cf6;

    --btn-bg:     #0f172a;
    --btn-text:   #ffffff;
    --btn-hover:  #1e293b;

    --radius:   12px;
    --radius-sm: 8px;
}

[data-theme="dark"] {
    --bg:       #121212;
    --surface:  #1e1e1e;
    --border:   #333333;

    --text-1:   #f9fafb;
    --text-2:   #9ca3af;
    --text-3:   #6b7280;

    --black:    #ffffff;

    --btn-bg:     #4f46e5;
    --btn-text:   #ffffff;
    --btn-hover:  #4338ca;
}

/* === RESPONSIVE UTILITIES === */
.desktop-only { display: flex !important; }
.mobile-only  { display: none !important; }

@media (max-width: 1024px) {
    .desktop-only { display: none !important; }
    .mobile-only  { display: flex !important; }
}

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-1);
    -webkit-font-smoothing: antialiased;
    transition: font-family 0.3s ease;
}

#app-shell,
#app-shell * {
    font-family: inherit;
}

input, textarea, select {
    font-family: inherit;
    background: var(--surface);
    color: var(--text-1);
    border: 1px solid var(--border);
    outline: none;
}

input::placeholder, textarea::placeholder {
    color: var(--text-3);
}

/* === APP SHELL (3-column grid) === */
#app-shell {
    display: grid;
    grid-template-columns: 64px 260px 1fr;
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns 0.22s ease;
}

#app-shell.sidebar-collapsed {
    grid-template-columns: 64px 0 1fr;
}

/* === ICON RAIL === */
#icon-rail {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    gap: 8px;
}

.rail-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-3);
    cursor: pointer;
    transition: all .15s ease;
}

.rail-icon:hover {
    color: var(--text-1);
    background: var(--bg);
}

.rail-icon.active {
    color: var(--blue);
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
}

.rail-icon-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    flex: 1;
}

.rail-icon-fab {
    margin-top: auto;
    background: var(--btn-bg);
    color: var(--btn-text);
    border-color: var(--btn-bg);
}

.rail-icon-fab:hover {
    background: var(--btn-hover);
    color: var(--btn-text);
}

/* === SIDEBAR === */
#sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
    transition: opacity 0.18s ease, transform 0.22s ease, border-color 0.18s ease;
}

#app-shell.sidebar-collapsed #sidebar {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-12px);
    border-right-color: transparent;
}

.sidebar-toggle-restore-icon {
    display: none;
}

#app-shell.sidebar-collapsed .sidebar-toggle-menu-icon {
    display: none;
}

#app-shell.sidebar-collapsed .sidebar-toggle-restore-icon {
    display: block;
}

.sidebar-top { flex: 1; }

.sidebar-header-icon-box {
    width: 38px;
    height: 38px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    flex-shrink: 0;
}

.sidebar-project {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 28px 24px 20px;
}

.project-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-1);
}

.project-id {
    font-size: 12px;
    color: var(--text-3);
    font-weight: 500;
}

/* Sidebar Nav */
.sidebar-nav {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    transition: all .15s ease;
}

.nav-link svg {
    flex-shrink: 0;
    color: var(--text-3);
}

.nav-link:hover {
    background: var(--bg);
    color: var(--text-1);
}

.nav-link.active {
    background: var(--bg);
    color: var(--text-1);
    font-weight: 600;
}

.nav-link.active svg {
    color: var(--text-1);
}

.task-subnav {
    display: none;
    flex-direction: column;
    gap: 3px;
    margin: -2px 0 4px 34px;
    padding: 4px 0 4px 12px;
    border-left: 1px solid var(--border);
}

.sidebar-nav.task-subnav-open .task-subnav {
    display: flex;
}

.task-subnav-link {
    display: flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
}

.task-subnav-link:hover,
.task-subnav-link.active {
    background: var(--bg);
    color: var(--text-1);
}

/* Sidebar Bottom (Profile) */
.sidebar-bottom {
    border-top: 1px solid var(--border);
    padding: 16px 16px;
}

.profile-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-row img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-email {
    font-size: 11px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-btn {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.profile-menu-btn:hover { color: var(--red); }

/* === MAIN AREA === */
#main-area {
    padding: 36px 48px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.main-header {
    margin-bottom: 24px;
}

.main-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-1);
}

/* Font Selector */
.font-dropdown {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-size: 13px;
    color: var(--text-2);
    outline: none;
    cursor: pointer;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
}

.filter-chip {
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: all .15s ease;
}

.filter-chip:hover {
    background: var(--bg);
}

.filter-chip.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    border-color: var(--btn-bg);
}

/* Composer */
.composer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
}

.composer-top {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

#todo-input, .composer-input {
    flex: 1;
    border: none;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-1);
    outline: none;
    background: transparent;
    min-width: 0;
    padding: 8px 0;
}

textarea.composer-input {
    line-height: 1.5;
    font-family: inherit;
}


#todo-input::placeholder, .composer-input::placeholder { color: var(--text-3); }

#add-btn, .composer-submit-btn {
    padding: 8px 20px;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

#add-btn:hover, .composer-submit-btn:hover {
    background: var(--btn-hover);
}

.composer-details {
    display: flex;
    gap: 12px;
}

.composer-details input,
.composer-details select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-2);
    background: var(--bg);
    outline: none;
}

.composer-icon-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.composer-icon-btn:hover {
    background: var(--border);
    color: var(--blue);
}

.task-img-preview-container {
    position: relative;
    margin-top: 12px;
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--blue);
}

.task-img-preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-img-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}


#memo-input { flex: 1; }

/* Search */
.search-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.search-svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
}

#search-input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-1);
    outline: none;
}

#search-input:focus { border-color: var(--blue); }
#search-input::placeholder { color: var(--text-3); }

/* === TASK LIST (vertical stack, like reference) === */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    list-style: none;
}

/* Task Card */
.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    transition: box-shadow .2s ease;
    animation: fadeSlideUp .3s ease;
}

.task-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.task-card.completed { opacity: 0.6; }

.task-card.completed .tc-title {
    text-decoration: line-through;
    color: var(--text-3);
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Card inner layout */
.tc-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.tc-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-1);
}

.tc-status {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
}

.tc-status.green  { border: 2.5px solid var(--green); }
.tc-status.blue   { border: 2.5px solid var(--blue); }
.tc-status.red    { border: 2.5px solid var(--red); }

.tc-subtitle {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tc-desc {
    font-size: 14px;
    color: var(--text-2);
    line-height: 1.6;
    margin-bottom: 20px;
}

.tc-img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 0.2s;
}

.tc-img:hover {
    transform: scale(1.01);
}


/* Action buttons */
.tc-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.tc-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s ease;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-1);
}

.tc-action-btn:hover { background: var(--bg); }

.btn-edit { color: var(--blue); }
.btn-archive { color: var(--text-2); }

/* Completed state */
.task-card.completed .tc-action-btn.btn-toggle {
    background: var(--btn-bg);
    border: 1px solid var(--btn-bg);
    color: var(--btn-text);
}

/* Delete button (hidden by default) */
.tc-delete {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-3);
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease;
}

.task-card:hover .tc-delete { opacity: 1; }
.tc-delete:hover { color: var(--red); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-3);
    font-size: 15px;
    font-weight: 500;
}

/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: var(--surface);
    padding: 32px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.modal-header {
    margin-bottom: 24px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: var(--bg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

/* ================================================
   AUTH PAGES
   ================================================ */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 24px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 20px 25px -5px rgba(0,0,0,0.04);
}

.auth-card h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-3);
    margin-bottom: 32px;
}

.auth-form-group {
    margin-bottom: 18px;
}

.auth-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-2);
    margin-bottom: 6px;
}

.auth-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-1);
    background: var(--bg);
    outline: none;
    transition: border-color .2s;
}

.auth-input:focus { border-color: var(--black); }
.auth-input::placeholder { color: var(--text-3); }

.confirm-btn {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.confirm-btn:hover { background: var(--btn-hover); }

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-1);
    cursor: pointer;
    transition: all .15s;
}

.composer-details input[type="date"],
.composer-details select,
.composer-details input[type="text"] {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-2);
    outline: none;
    cursor: pointer;
    transition: border-color .15s ease;
}

.composer-details input:focus,
.composer-details select:focus {
    border-color: var(--blue);
}

.google-btn:hover {
    background: var(--bg);
    border-color: var(--text-3);
}

.google-btn img {
    width: 18px;
    height: 18px;
}

.auth-links {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-3);
}

.auth-warning {
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.1);
    color: var(--text-2);
    font-size: 0.82rem;
    line-height: 1.45;
}

.auth-warning a {
    color: var(--blue);
    font-weight: 700;
}

.auth-copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    padding: 4px 8px;
    border: 1px solid rgba(37, 99, 235, 0.35);
    border-radius: 6px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--blue);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.auth-copy-btn:hover {
    background: rgba(37, 99, 235, 0.14);
}

.auth-links a {
    color: var(--black);
    font-weight: 600;
    text-decoration: none;
}

.auth-links a:hover { text-decoration: underline; }

/* ================================================
   TOAST
   ================================================ */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.toast {
    background: #0f172a;
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
    margin-top: 8px;
    transition: opacity .3s;
    animation: toastIn .3s ease;
}

[data-theme="dark"] .toast {
    background: #27272a;
    color: #f9fafb;
}

.toast.success { background: var(--green); color: #fff; }
.toast.error   { background: var(--red); color: #fff; }
.toast.fade-out { opacity: 0; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.onboarding-modal {
    position: fixed;
    inset: 0;
    z-index: 8060;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: transparent;
    pointer-events: none;
}

.onboarding-modal.active {
    display: flex;
}

.onboarding-modal.positioned {
    align-items: stretch;
    justify-content: stretch;
}

.onboarding-card {
    width: clamp(520px, 62vw, 760px);
    max-width: calc(100vw - 48px);
    max-height: min(820px, calc(100vh - 48px));
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
    padding: 28px 30px;
    pointer-events: auto;
    position: relative;
    z-index: 8060;
}

.onboarding-modal.positioned .onboarding-card {
    position: fixed;
    width: clamp(380px, 34vw, 560px);
    max-width: calc(100vw - 32px);
    max-height: min(720px, calc(100vh - 32px));
}

.onboarding-modal.welcome {
    padding: 0;
    background:
        radial-gradient(circle at 50% 20%, rgba(74, 144, 226, 0.18), transparent 34%),
        linear-gradient(180deg, var(--surface), var(--bg));
}

.onboarding-modal.welcome .onboarding-card {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    padding: 32px clamp(22px, 5vw, 72px);
}

.onboarding-modal.welcome .onboarding-topbar {
    position: relative;
    z-index: 2;
}

.onboarding-modal.welcome .onboarding-eyebrow,
.onboarding-modal.welcome #onboarding-title,
.onboarding-modal.welcome .onboarding-progress,
.onboarding-modal.welcome .onboarding-intro,
.onboarding-modal.welcome .onboarding-step-card,
.onboarding-modal.welcome .onboarding-step-summary,
.onboarding-modal.welcome .onboarding-step-list,
.onboarding-modal.welcome #onboarding-complete-btn {
    display: none;
}

.onboarding-welcome {
    display: none;
}

.onboarding-modal.welcome .onboarding-welcome {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    text-align: center;
    padding: 42px 0;
}

.onboarding-welcome-mark {
    width: 112px;
    height: 112px;
    border-radius: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.onboarding-welcome-mark img {
    width: 72px;
    height: 72px;
}

.onboarding-welcome h3 {
    max-width: 900px;
    margin: 12px 0 0;
    color: var(--text-1);
    font-size: clamp(2.6rem, 7vw, 5.8rem);
    font-weight: 850;
    line-height: 1.04;
    letter-spacing: 0;
}

.onboarding-welcome p {
    max-width: 680px;
    margin: 0;
    color: var(--text-2);
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    line-height: 1.65;
}

.onboarding-welcome span {
    color: var(--text-3);
    font-size: 0.95rem;
    font-weight: 700;
}

.onboarding-language-choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    margin-top: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.08);
}

.onboarding-language-option {
    min-width: 92px;
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.onboarding-language-option:hover {
    color: var(--text-1);
}

.onboarding-language-option.active {
    background: var(--text-1);
    color: var(--surface);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.16);
}

.onboarding-modal.welcome .onboarding-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: clamp(18px, 4vh, 42px);
}

.onboarding-modal.welcome #onboarding-start-btn {
    width: auto;
    min-width: 156px;
    min-height: 48px;
    border-radius: 999px;
    padding: 12px 24px;
    flex: 0 0 auto;
}

.onboarding-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.onboarding-exit-btn {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.onboarding-exit-btn:hover {
    color: var(--text-1);
    border-color: var(--blue);
}

.onboarding-eyebrow {
    color: var(--blue);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 10px;
}

.onboarding-card h2,
#onboarding-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    line-height: 1.25;
    margin: 0 0 10px;
}

.onboarding-intro {
    color: var(--text-2);
    line-height: 1.55;
    font-size: 0.95rem;
    margin: 18px 0 18px;
}

.onboarding-progress {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    margin: 12px 0 0;
}

.onboarding-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.onboarding-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--green));
    transition: width 0.2s ease;
}

#onboarding-progress-text {
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 700;
}

.onboarding-step-card {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg) 78%, var(--surface));
}

.onboarding-step-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--blue);
    flex: 0 0 auto;
}

.onboarding-step-card strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 4px;
}

.onboarding-step-card p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.9rem;
    line-height: 1.55;
}

.onboarding-step-card .onboarding-step-target {
    margin-top: 12px;
    color: var(--blue);
    font-weight: 700;
}

.onboarding-guide-details {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
}

.onboarding-detail-row {
    display: grid;
    grid-template-columns: 118px 1fr;
    gap: 16px;
    align-items: start;
}

.onboarding-detail-label {
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 800;
    padding-top: 2px;
}

.onboarding-detail-row p {
    color: var(--text-2);
    font-size: 0.86rem;
    line-height: 1.45;
}

.onboarding-example-row p {
    display: block;
    width: fit-content;
    max-width: 100%;
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: color-mix(in srgb, var(--surface) 86%, var(--blue));
    color: var(--text-1);
    font-weight: 700;
}

.onboarding-step-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 0 12px;
}

#onboarding-step-summary-text {
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 700;
}

.onboarding-step-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0 20px;
}

.onboarding-modal:not(.steps-expanded) .onboarding-step-list {
    display: none;
}

.onboarding-step-pill {
    min-width: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 7px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-2);
}

.onboarding-step-pill.active {
    border-color: var(--blue);
    color: var(--text-1);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.14);
}

.onboarding-step-pill.completed,
.onboarding-step-pill.skipped {
    background: var(--bg);
}

.onboarding-step-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    font-weight: 800;
}

.onboarding-step-pill em {
    grid-column: 1 / -1;
    font-style: normal;
    color: var(--text-2);
    font-size: 0.74rem;
}

.onboarding-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.onboarding-actions .text-link-btn {
    white-space: nowrap;
    min-height: 42px;
    padding: 10px 14px;
    justify-content: center;
}

.onboarding-actions .confirm-btn {
    width: clamp(180px, 28vw, 270px);
    min-height: 42px;
    justify-content: center;
    white-space: nowrap;
}

.onboarding-spotlight-shade {
    position: fixed;
    z-index: 8040;
    background: rgba(15, 23, 42, 0.46);
    pointer-events: none;
}

.onboarding-highlight-target {
    position: relative;
    z-index: 8070 !important;
    isolation: isolate;
    outline: 3px solid var(--blue);
    outline-offset: 5px;
    box-shadow: 0 0 0 8px rgba(74, 144, 226, 0.22), 0 20px 50px rgba(15, 23, 42, 0.28) !important;
}

.onboarding-target-tip {
    position: fixed;
    z-index: 8075;
    max-width: min(300px, calc(100vw - 28px));
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--text-1);
    color: var(--surface);
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.35;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.24);
    pointer-events: none;
}

@media (max-width: 1024px) {
    .onboarding-modal {
        align-items: flex-end;
        justify-content: center;
        padding: 14px;
        background: transparent;
    }

    .onboarding-card {
        width: 100%;
        max-width: 640px;
        max-height: min(82vh, 720px);
        border-radius: 18px 18px 14px 14px;
        padding: 22px;
    }

    .onboarding-card h2 {
        font-size: 1.35rem;
    }

    .onboarding-intro {
        font-size: 0.9rem;
    }

    .onboarding-step-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .onboarding-modal {
        padding: 0;
        align-items: flex-end;
        justify-content: stretch;
    }

    .onboarding-card {
        width: 100%;
        max-height: 88vh;
        border-radius: 22px 22px 0 0;
        padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
    }

    .onboarding-modal.positioned .onboarding-card {
        position: relative;
        left: auto !important;
        top: auto !important;
        width: 100%;
        max-height: 88vh;
    }

    .onboarding-modal.compact .onboarding-card {
        max-height: 34vh;
        padding: 14px 14px calc(12px + env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0;
    }

    .onboarding-modal.compact .onboarding-eyebrow,
    .onboarding-modal.compact .onboarding-intro,
    .onboarding-modal.compact .onboarding-step-list,
    .onboarding-modal.compact .onboarding-step-summary,
    .onboarding-modal.compact .onboarding-guide-details,
    .onboarding-modal.compact .onboarding-step-icon {
        display: none;
    }

    .onboarding-modal.compact .onboarding-topbar {
        gap: 10px;
        align-items: center;
    }

    .onboarding-modal.compact #onboarding-title {
        font-size: 0.95rem;
        margin: 0;
    }

    .onboarding-modal.compact .onboarding-progress {
        margin-top: 10px;
    }

    .onboarding-modal.compact .onboarding-step-card {
        display: block;
        padding: 0;
        margin-top: 10px;
        border: 0;
        background: transparent;
    }

    .onboarding-modal.compact .onboarding-step-card strong {
        font-size: 0.92rem;
        margin-bottom: 2px;
    }

    .onboarding-modal.compact .onboarding-step-card p:not(.onboarding-step-target) {
        display: none;
    }

    .onboarding-modal.compact .onboarding-step-card .onboarding-step-target {
        margin-top: 2px;
        font-size: 0.78rem;
        line-height: 1.35;
    }

    .onboarding-modal.compact .onboarding-actions {
        display: flex;
        gap: 8px;
        margin-top: 10px;
    }

    .onboarding-modal.compact .onboarding-actions .confirm-btn,
    .onboarding-modal.compact .onboarding-actions .text-link-btn {
        min-height: 36px;
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .onboarding-step-card {
        grid-template-columns: 40px 1fr;
        padding: 14px;
    }

    .onboarding-detail-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .onboarding-example-row p {
        width: 100%;
    }

    .onboarding-step-icon {
        width: 40px;
        height: 40px;
    }

    .onboarding-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .onboarding-actions .confirm-btn,
    .onboarding-actions .text-link-btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    .onboarding-modal.compact .onboarding-actions {
        display: flex;
        grid-template-columns: none;
    }

    .onboarding-modal.compact .onboarding-actions .confirm-btn,
    .onboarding-modal.compact .onboarding-actions .text-link-btn {
        width: auto;
        flex: 1;
        min-height: 36px;
    }
}

/* =========================================================
   SPA Page Routing & New Components
   ========================================================= */

/* Page Content Routing */
.page-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Empty State */
.empty-state {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-secondary);
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border);
    margin-top: var(--spacing-md);
}

/* Notes Area (Free Positioning) */
.notes-grid {
    position: relative;
    width: 100%;
    min-height: 600px; /* Allow space to move */
    background:
        linear-gradient(180deg, rgba(255,255,255,0.52), rgba(255,255,255,0.18)),
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 39px,
            rgba(15, 23, 42, 0.045) 39px,
            rgba(15, 23, 42, 0.045) 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 39px,
            rgba(15, 23, 42, 0.035) 39px,
            rgba(15, 23, 42, 0.035) 40px
        ),
        linear-gradient(135deg, #faf7ef 0%, #f4efe2 100%);
    margin-top: var(--spacing-lg);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 10px 24px rgba(15, 23, 42, 0.05);
}

.note-card {
    position: absolute; /* Changed from static/grid */
    width: 240px;
    background-color: #fffbc8; /* Default Yellow */
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: 2px 4px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    cursor: move; /* Indicate draggable */
    user-select: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    z-index: 1;
}

.note-card:hover {
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
    transform: translateY(-2px) rotate(-1deg);
}

/* Color Variants */
.note-card.color-yellow { background-color: #fffbc8; border-color: #efe8a0; }
.note-card.color-blue   { background-color: #e1f5fe; border-color: #b3e5fc; }
.note-card.color-green  { background-color: #e8f5e9; border-color: #c8e6c9; }
.note-card.color-pink   { background-color: #fce4ec; border-color: #f8bbd0; }
.note-card.color-purple { background-color: #f3e5f5; border-color: #e1bee7; }
.note-card.color-orange { background-color: #fff3e0; border-color: #ffe0b2; }

/* Color Picker UI */
.color-selector {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
}

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--border);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.color-option:hover { transform: scale(1.15); border-color: var(--text-2); }
.color-option.selected { border-color: var(--blue); transform: scale(1.1); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--blue); }


.opt-yellow { background-color: #fffbc8; }
.opt-blue   { background-color: #e1f5fe; }
.opt-green  { background-color: #e8f5e9; }
.opt-pink   { background-color: #fce4ec; }
.opt-purple { background-color: #f3e5f5; }
.opt-orange { background-color: #fff3e0; }

.note-content {
    color: #333;
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre-wrap;
    flex-grow: 1;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-md);
    font-size: 0.75rem;
    color: #777;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: var(--spacing-sm);
}

.note-delete-btn {
    background: none;
    border: none;
    color: var(--red);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.note-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.note-edit-btn {
    background: none;
    border: none;
    color: var(--blue);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.note-empty-container {
    min-height: 560px;
    background: transparent;
}

.note-empty-illustration {
    color: #b45309;
}

.note-empty-container:hover .note-empty-illustration {
    transform: translateY(-8px) rotate(2deg);
}

[data-theme="dark"] .notes-grid {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 39px,
            rgba(255,255,255,0.05) 39px,
            rgba(255,255,255,0.05) 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 39px,
            rgba(255,255,255,0.035) 39px,
            rgba(255,255,255,0.035) 40px
        ),
        linear-gradient(135deg, #26221c 0%, #1e1a15 100%);
    border-color: rgba(255,255,255,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 10px 24px rgba(0,0,0,0.2);
}

/* Profile Card */
.profile-card {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 20px;
}

.profile-card p {
    margin-bottom: 12px;
    font-size: 1.05rem;
    color: var(--text-1);
}

.profile-password-panel {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.profile-language-panel,
.profile-font-panel {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.profile-font-panel {
    margin-top: 12px;
}

.profile-language-panel label,
.profile-font-panel label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-1);
}

.profile-guide-panel {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.profile-guide-panel h3 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-1);
}

.profile-guide-panel p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.88rem;
    line-height: 1.45;
}

.profile-guide-panel .confirm-btn {
    width: auto;
    flex-shrink: 0;
    padding: 10px 18px;
}

.profile-password-panel h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--text-1);
}

.profile-help-text,
.profile-status-text {
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.5;
}

.profile-status-text {
    min-height: 1.4em;
    margin-top: 10px;
}

.profile-status-text.success {
    color: var(--green);
}

.profile-status-text.error {
    color: var(--red);
}

.profile-password-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.profile-password-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-2);
}

@media (max-width: 768px) {
    .profile-password-grid {
        grid-template-columns: 1fr;
    }

    #main-area {
        padding: 18px 14px;
    }

    .main-header {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 12px;
    }

    .main-header h1 {
        font-size: 1.45rem;
        overflow-wrap: anywhere;
    }

    .filter-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        overflow-x: visible;
        padding-bottom: 0;
        width: 100%;
    }

    .filter-chip {
        width: 100%;
        min-width: 0;
        padding: 9px 10px;
        text-align: center;
        white-space: normal;
    }

    .project-card {
        padding: 16px;
    }

    .project-detail-header {
        align-items: flex-start;
    }

    .project-detail-header .wiki-icon-btn {
        flex: 0 0 auto;
    }
}

@media (max-width: 420px) {
    .composer-details input,
    .composer-details select {
        min-width: 100%;
    }

    .project-detail-section-header .text-link-btn,
    .project-card-actions .text-link-btn {
        width: 100%;
        text-align: center;
    }

    .project-detail-item strong,
    .project-detail-item small {
        overflow-wrap: anywhere;
    }
}

/* === DASHBOARD SPECIFIC STYLES === */
.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 24px;
}

.dashboard-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info .stat-label {
    font-size: 0.8rem;
    color: var(--text-2);
    display: block;
}

.stat-info .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
}

/* Progress Bar */
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--blue);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dashboard Grid & Widgets */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
}

.dashboard-widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.text-link-btn {
    background: none;
    border: none;
    color: var(--blue);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.widget-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Mini Items in Dashboard */
.dash-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid transparent;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.dash-item:hover {
    border-color: var(--border);
    background: var(--surface);
}

.dash-item-info h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.dash-item-info p {
    font-size: 0.8rem;
    color: var(--text-2);
}

.dash-recent-note-card {
    background: #fffbc8;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #333; /* Ensure text is dark on light yellow background */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.dash-recent-note-card:hover {
    transform: translateY(-2px);
}

.dash-recent-note-card.blue   { background-color: #e1f5fe; border-color: #b3e5fc; }
.dash-recent-note-card.green  { background-color: #e8f5e9; border-color: #c8e6c9; }
.dash-recent-note-card.pink   { background-color: #fce4ec; border-color: #f8bbd0; }
.dash-recent-note-card.purple { background-color: #f3e5f5; border-color: #e1bee7; }
.dash-recent-note-card.orange { background-color: #fff3e0; border-color: #ffe0b2; }


/* === PROJECTS PAGE === */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.05);
    border-color: var(--blue);
}

.project-card .project-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--blue);
}

.project-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.project-card .task-count {
    font-size: 0.8rem;
    color: var(--text-2);
}

.project-card .delete-project {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 1.2rem;
    cursor: pointer;
}

.project-card-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
}

.project-detail-panel {
    margin-top: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.project-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.project-detail-kicker {
    display: block;
    margin-bottom: 6px;
    color: var(--blue);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
}

.project-detail-header h2 {
    margin: 0 0 6px;
    font-size: 1.45rem;
}

.project-detail-header p {
    margin: 0;
    color: var(--text-2);
    font-size: 0.9rem;
}

.project-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 20px;
}

.project-detail-section {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    background: var(--bg);
}

.project-detail-section-wide {
    grid-column: 1 / -1;
}

.project-detail-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.project-detail-section-header h3 {
    margin: 0;
    font-size: 0.95rem;
}

.project-detail-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-detail-wiki-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.project-detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 62px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 12px 14px;
    color: var(--text-1);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.project-detail-item:hover {
    border-color: var(--blue);
    transform: translateY(-1px);
}

.project-detail-item span {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.project-detail-item strong {
    font-size: 0.9rem;
}

.project-detail-item small {
    color: var(--text-2);
    font-size: 0.78rem;
}

.project-detail-item em {
    color: var(--text-2);
    font-size: 0.76rem;
    font-style: normal;
    flex-shrink: 0;
}

.project-detail-empty {
    margin: 0;
    padding: 16px;
    color: var(--text-2);
    border: 1px dashed var(--border);
    border-radius: 12px;
    font-size: 0.85rem;
}

/* === BOOKMARKS PAGE === */
.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.bookmark-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
}

.bookmark-card:hover {
    border-color: var(--blue);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.bm-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bm-favicon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
}

.bm-title {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.bm-url {
    font-size: 0.75rem;
    color: var(--text-3);
    display: block;
    margin-top: 2px;
}

.bm-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-chip {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-2);
    border: 1px solid var(--border);
}

.bm-actions {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bm-link {
    color: var(--blue);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
}

.bm-delete,
.bm-delete-btn {
    background: none;
    border: none;
    color: var(--red);
    font-size: 0.8rem;
    cursor: pointer;
}

.bm-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-3);
    transition: background 0.15s ease, color 0.15s ease;
}

.bm-delete-btn:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--red);
}

.project-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    margin-bottom: 4px;
}





/* =========================================================
   RESPONSIVE DESIGN (Media Queries)
   ========================================================= */

/* --- DESKTOP VIEW (> 1024px) --- */
@media (min-width: 1025px) {
    #app-shell {
        grid-template-columns: 64px 260px 1fr;
    }
    
    #icon-rail, #sidebar {
        display: flex !important;
        transform: none !important;
        position: relative !important;
        left: auto !important;
        box-shadow: none !important;
    }

    #mobile-header, #mobile-nav-container, #sidebar-overlay {
        display: none !important;
    }
}

/* --- MOBILE & TABLET VIEW (< 1024px) --- */
@media (max-width: 1024px) {
    #app-shell {
        grid-template-columns: 1fr; /* Single column */
        height: 100vh;
        overflow: hidden;
    }

    /* Mobile Header */
    #mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        height: 60px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    #menu-toggle {
        background: none;
        border: none;
        color: var(--text-1);
        cursor: pointer;
        padding: 8px;
        margin-left: -8px;
    }

    .mobile-logo {
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--text-1);
    }

    #mobile-user-avatar img {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        object-fit: cover;
    }

    /* Navigation Drawer (Icon Rail + Sidebar) */
    #icon-rail, #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 2001;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
        box-shadow: 20px 0 30px rgba(0,0,0,0.1);
    }

    #icon-rail {
        width: 64px;
        border-right: none;
        transform: translateX(-64px); 
    }

    #sidebar {
        left: 64px;
        width: 260px;
        border-left: 1px solid var(--border);
        transform: translateX(-324px); 
    }

    .nav-open #icon-rail { transform: translateX(0); }
    .nav-open #sidebar { transform: translateX(0); transition-delay: 0.05s; }

    /* Staggered Content Animation */
    .nav-open .nav-link,
    .nav-open .rail-icon:not(.rail-icon-fab) {
        animation: drawerItemIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    .nav-open .rail-icon-group .rail-icon:nth-child(1) { animation-delay: 0.1s; }
    .nav-open .rail-icon-group .rail-icon:nth-child(2) { animation-delay: 0.12s; }
    .nav-open .rail-icon-group .rail-icon:nth-child(3) { animation-delay: 0.14s; }
    .nav-open .rail-icon-group .rail-icon:nth-child(4) { animation-delay: 0.16s; }
    .nav-open .rail-icon-group .rail-icon:nth-child(5) { animation-delay: 0.18s; }

    .nav-open .sidebar-nav .nav-link:nth-child(1) { animation-delay: 0.15s; }
    .nav-open .sidebar-nav .nav-link:nth-child(2) { animation-delay: 0.18s; }
    .nav-open .sidebar-nav .nav-link:nth-child(3) { animation-delay: 0.21s; }
    .nav-open .sidebar-nav .nav-link:nth-child(4) { animation-delay: 0.24s; }
    .nav-open .sidebar-nav .nav-link:nth-child(5) { animation-delay: 0.27s; }
    .nav-open .sidebar-nav .nav-link:nth-child(6) { animation-delay: 0.30s; }

    @keyframes drawerItemIn {
        from { opacity: 0; transform: translateX(-15px); }
        to { opacity: 1; transform: translateX(0); }
    }

    /* Sidebar Overlay */
    #sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 2000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s ease;
    }

    .nav-open #sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    /* Main Area Adjustments */
    #main-area {
        padding: 24px 20px;
        height: calc(100vh - 60px); 
    }

    /* Composer Adjustments */
    .composer { padding: 12px 16px; }
    .composer-top { flex-direction: column; gap: 8px; }
    #add-btn, .composer-submit-btn { width: 100%; padding: 10px; }
    .composer-details { flex-wrap: wrap; gap: 8px; }
    .composer-details input, .composer-details select { flex: 1; min-width: 120px; }
    #memo-input { width: 100%; flex: none; }

    /* Dashboard & Cards */
    .dashboard-stats-row, .dashboard-grid { grid-template-columns: 1fr !important; }
    .projects-grid, .bookmarks-grid { grid-template-columns: 1fr !important; }
    .stat-card, .task-card { padding: 16px; }
    .tc-title { font-size: 15px; }
    .tc-desc { font-size: 13px; margin-bottom: 16px; }
    .tc-action-btn { font-size: 12px; padding: 8px; }

    .project-detail-panel {
        padding: 16px;
        margin-top: 20px;
        border-radius: 16px;
    }

    .project-detail-header {
        gap: 12px;
    }

    .project-detail-header h2 {
        font-size: 1.2rem;
        overflow-wrap: anywhere;
    }

    .project-detail-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .project-detail-section-wide {
        grid-column: auto;
    }

    .project-detail-section {
        padding: 14px;
    }

    .project-detail-section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .project-detail-wiki-list {
        grid-template-columns: 1fr;
    }

    .project-detail-item {
        align-items: flex-start;
        flex-direction: column;
        min-height: 0;
    }

    .project-card-actions {
        flex-wrap: wrap;
    }

    /* Note Grid */
    .notes-grid { display: flex; flex-wrap: wrap; gap: 16px; padding: 0; background: none; min-height: 400px; }
    .note-card { width: calc(50% - 10px); position: relative !important; left: auto !important; top: auto !important; margin-bottom: 16px; }

    /* =========================================================
       RADIAL FAB NAVIGATION
       ========================================================= */
    #mobile-nav-container {
        position: fixed;
        bottom: 24px;
        right: 24px;
        z-index: 5000;
        display: block !important;
    }

    .fab-main {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--blue); /* Changed from var(--black) to avoid white-on-white in dark mode */
        color: #fff;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        cursor: pointer;
        transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 5002;
        position: relative;
    }

    .fab-container.active .fab-main {
        transform: none;
        background: var(--blue);
        color: #fff;
    }

    .fab-menu {
        position: absolute;
        bottom: 72px;
        right: 0;
        width: min(236px, calc(100vw - 48px));
        padding: 10px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        border: 1px solid var(--border);
        border-radius: 16px;
        background: color-mix(in srgb, var(--surface) 94%, transparent);
        box-shadow: 0 18px 36px rgba(0,0,0,0.18);
        backdrop-filter: blur(16px);
        z-index: 5001;
        pointer-events: none;
        opacity: 0;
        transform: translateY(10px) scale(0.96);
        transform-origin: bottom right;
        transition: opacity 0.18s ease, transform 0.18s ease;
    }

    .fab-container.active .fab-menu {
        pointer-events: auto;
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    .fab-item {
        position: relative;
        width: 100%;
        min-height: 48px;
        border-radius: 12px;
        background: var(--surface);
        border: 1px solid var(--border);
        color: var(--text-1);
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
        padding: 8px 10px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        cursor: pointer;
        opacity: 1;
        transform: none;
        transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    }

    .fab-label {
        position: static;
        background: transparent;
        color: inherit;
        padding: 0;
        border-radius: 0;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
        opacity: 1;
        pointer-events: none;
    }

    .fab-item:hover {
        background: var(--blue);
        color: #fff;
    }

    .fab-item.active {
        background: var(--blue);
        color: #fff;
        border-color: var(--blue);
    }
}

/* === WIKI & DOCS UI === */
.wiki-layout {
    display: flex;
    flex-direction: row;
    gap: 24px;
    height: calc(100vh - 160px);
    margin-top: 16px;
}

.wiki-sidebar {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-right: 1px solid var(--border);
    padding-right: 20px;
    flex-shrink: 0;
}

.wiki-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wiki-page-item {
    padding: 12px 16px;
    padding-left: calc(16px + (var(--wiki-depth, 0) * 18px));
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all .2s;
    font-size: 14px;
    color: var(--text-2);
    font-weight: 500;
}

.wiki-page-item:hover, .wiki-page-item.active {
    border-color: var(--blue);
    color: var(--text-1);
    background: var(--bg);
}

.wiki-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 30px 40px;
    overflow-y: auto;
    position: relative;
}

.wiki-title-input {
    font-size: 32px;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--text-1);
    outline: none;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    font-family: inherit;
    width: 100%;
}

.wiki-title-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
}

.wiki-title-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
    padding-right: 220px;
}

.wiki-title-row .wiki-title-input {
    flex: 1;
    min-width: 0;
}

.wiki-project-control {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wiki-project-control label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-2);
    white-space: nowrap;
}

.wiki-project-select {
    min-width: 190px;
    height: 42px;
    margin-top: 2px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
    color: var(--text-1);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    outline: none;
}

.wiki-project-select:focus {
    border-color: var(--blue);
}

.wiki-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

#editorjs {
    flex: 1;
    min-height: 300px;
}

#editorjs .codex-editor {
    position: relative;
    z-index: 1;
}

#editorjs .ce-block__content,
#editorjs .ce-toolbar__content {
    max-width: 100%;
}

#editorjs .ce-popover,
#editorjs .ce-inline-toolbar,
#editorjs .ce-conversion-toolbar {
    z-index: 9000;
}

#editorjs .ce-popover {
    max-width: min(360px, calc(100vw - 32px));
}

.wiki-subpages-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.wiki-subpages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.wiki-subpages-header h3 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-1);
}

.wiki-subpages-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.wiki-subpage-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg);
    color: var(--text-1);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.wiki-subpage-card:hover {
    border-color: var(--blue);
    transform: translateY(-1px);
}

.wiki-subpage-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.08);
    color: var(--blue);
    flex-shrink: 0;
    font-size: 22px;
    line-height: 1;
}

.wiki-subpage-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.wiki-subpage-text strong,
.wiki-subpage-text span {
    display: block;
}

.wiki-subpage-text strong {
    font-size: 0.95rem;
}

.wiki-subpage-text span {
    font-size: 0.82rem;
    color: var(--text-2);
}

.wiki-subpage-create-card {
    border-style: dashed;
}

/* Editor.js Dark Mode Overrides */
[data-theme="dark"] .codex-editor {
    --color-background-document: var(--bg) !important;
    --color-background-item-hover: rgba(255, 255, 255, 0.05) !important;
    --color-background-item-focus: rgba(255, 255, 255, 0.1) !important;
    --color-text-primary: var(--text-1) !important;
    --color-text-secondary: var(--text-2) !important;
    --color-border-default: var(--border) !important;
    --color-background-item-default: var(--surface) !important;
}

[data-theme="dark"] .ce-block__content, 
[data-theme="dark"] .ce-toolbar__content {
    color: var(--text-1) !important;
}
[data-theme="dark"] .ce-popover,
[data-theme="dark"] .ce-inline-toolbar,
[data-theme="dark"] .ce-conversion-toolbar {
    background-color: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-1) !important;
}
[data-theme="dark"] .ce-popover-item:hover,
[data-theme="dark"] .ce-inline-tool:hover,
[data-theme="dark"] .ce-toolbar__settings-btn:hover,
[data-theme="dark"] .ce-toolbar__plus:hover,
[data-theme="dark"] .ce-conversion-tool:hover {
    background-color: var(--bg) !important;
    color: var(--text-1) !important;
}
[data-theme="dark"] .ce-popover-item__icon,
[data-theme="dark"] .ce-popover-item__title,
[data-theme="dark"] .ce-inline-tool,
[data-theme="dark"] .ce-conversion-tool__icon {
    color: var(--text-1) !important;
    background-color: transparent !important;
}
[data-theme="dark"] .cdx-input,
[data-theme="dark"] .ce-inline-toolbar__dropdown {
    background-color: var(--bg) !important;
    border-color: var(--border) !important;
    color: var(--text-1) !important;
}
[data-theme="dark"] .ce-popover-item--active {
    background-color: var(--blue) !important;
    color: #fff !important;
}
[data-theme="dark"] .ce-popover-item--active .ce-popover-item__icon,
[data-theme="dark"] .ce-popover-item--active .ce-popover-item__title {
    color: #fff !important;
}

/* Fix for Popover (Slash Command Menu) in Dark Mode - Broad Fix */
[data-theme="dark"] .ce-popover,
[data-theme="dark"] .ce-popover * {
    background-color: var(--surface) !important;
    color: var(--text-1) !important;
}

[data-theme="dark"] .ce-popover {
    border: 1px solid var(--border) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
}

[data-theme="dark"] .ce-popover-item:hover,
[data-theme="dark"] .ce-popover-item--active,
[data-theme="dark"] .ce-popover-item:hover * {
    background-color: var(--blue) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .ce-popover__search-field,
[data-theme="dark"] .ce-popover__search-field * {
    background-color: var(--bg) !important;
    border-bottom: 1px solid var(--border) !important;
}

[data-theme="dark"] .ce-popover-item__icon {
    background-color: transparent !important;
}

/* Code & Toggle Block Styles */
[data-theme="dark"] .ce-code__textarea {
    background-color: #1e1e1e !important;
    color: #d4d4d4 !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .ce-toggle__title {
    color: var(--text-1) !important;
}

[data-theme="dark"] .ce-toggle__content {
    color: var(--text-2) !important;
}

[data-theme="dark"] .ce-toggle__button {
    color: var(--text-1) !important;
}

/* EditorJS Table Support */
.tc-table {
    width: 100%;
    overflow-x: auto;
    display: block;
}

.tc-table td {
    color: var(--text-1);
    background: var(--surface);
    border-color: var(--border);
}

[data-theme="dark"] .tc-table td {
    color: var(--text-1) !important;
    background: var(--surface) !important;
    border-color: var(--border) !important;
}

/* Fix table tool icons and selectors in dark mode */
[data-theme="dark"] .tc-toolbox,
[data-theme="dark"] .tc-toolbox__toggler,
[data-theme="dark"] .tc-toolbox__toggler--active {
    color: var(--text-1) !important;
    background: var(--surface) !important;
}

[data-theme="dark"] .tc-toolbox__settings {
    background: var(--surface) !important;
    border-color: var(--border) !important;
}

@media (max-width: 768px) {
    .wiki-layout {
        flex-direction: column;
        height: auto;
    }
    .wiki-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-right: 0;
        padding-bottom: 20px;
        max-height: 250px;
    }
    .wiki-editor-container {
        padding: 20px 15px;
        min-height: 60vh;
    }
}

#wiki-search-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-1);
}

.wiki-layout {
    display: flex;
    height: calc(100vh - 180px);
    gap: 20px;
    transition: all 0.3s ease;
}

.wiki-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    padding-right: 20px;
    transition: all 0.3s ease;
}

.wiki-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wiki-page-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    padding-left: calc(12px + (var(--wiki-depth, 0) * 18px));
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
}

.wiki-page-item:hover {
    background: var(--bg);
    color: var(--text-1);
}

.wiki-page-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--blue);
    font-weight: 600;
}

.wiki-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 40px;
    overflow-y: auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    min-height: 0; /* Important for flex children scrolling */
}

/* Wiki Empty State Modern Styles */
.wiki-empty-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--bg);
    border-radius: var(--radius);
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

.wiki-empty-content {
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.wiki-empty-illustration {
    width: 140px;
    height: 140px;
    background: var(--surface);
    border-radius: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--blue);
    margin-bottom: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.wiki-empty-container:hover .wiki-empty-illustration {
    transform: translateY(-8px) rotate(3deg);
}

.wiki-empty-content h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-1);
    letter-spacing: -0.5px;
}

.wiki-empty-content p {
    font-size: 15px;
    color: var(--text-2);
    line-height: 1.6;
    margin-bottom: 8px;
}

.task-empty-container {
    min-height: 420px;
    margin-top: 8px;
}

.collection-empty-container {
    min-height: 360px;
    margin-top: 8px;
}

.projects-grid > .collection-empty-container,
.bookmarks-grid > .collection-empty-container {
    grid-column: 1 / -1;
    width: 100%;
}

.task-empty-content {
    max-width: 540px;
}

.collection-empty-content {
    max-width: 540px;
}

.task-empty-illustration {
    color: var(--green);
}

.collection-empty-illustration {
    width: 136px;
    height: 136px;
}

.project-empty-illustration {
    color: var(--blue);
}

.bookmark-empty-illustration {
    color: #d97706;
}

.archive-empty-illustration {
    color: var(--purple);
}

.task-empty-container:hover .task-empty-illustration {
    transform: translateY(-8px) rotate(-3deg);
}

.collection-empty-container:hover .collection-empty-illustration {
    transform: translateY(-8px) rotate(3deg);
}

.archive-empty-container:hover .archive-empty-illustration {
    transform: translateY(-8px) rotate(-3deg);
}

[data-theme="dark"] .wiki-empty-illustration {
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

/* Ensure editor grows and doesn't overlap actions */
#editorjs {
    width: 100%;
    min-height: 300px;
    margin-bottom: 20px;
    flex: 0 0 auto; /* Don't force flex grow, let content define height */
}

.wiki-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
    margin-bottom: 20px; /* Add bottom margin to ensure space at end */
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

#wiki-save-btn {
    flex: 1.5;
    height: 48px;
    font-size: 15px;
    font-weight: 600;
}

#wiki-delete-btn {
    flex: 1;
    height: 48px;
    background: rgba(239, 68, 68, 0.08);
    border: 1.5px solid var(--red);
    color: var(--red);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#wiki-delete-btn:hover {
    background: var(--red);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* Upload Progress Styles */
.upload-progress-container {
    padding: 12px 16px;
    background: rgba(37, 99, 235, 0.05);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--blue);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--blue);
}

[data-theme="dark"] .upload-progress-container {
    background: rgba(37, 99, 235, 0.15);
}


.wiki-editor-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
}

.wiki-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-2);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wiki-icon-btn:hover {
    background: var(--bg);
    color: var(--text-1);
}

.wiki-title-input {
    flex: 1;
    width: 100%;
    min-width: 0;
    font-size: 32px;
    font-weight: 800;
    border: none;
    background: transparent;
    color: var(--text-1);
    outline: none;
    font-family: inherit;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .wiki-layout {
        position: relative;
        overflow: visible;
    }
    
    .wiki-sidebar {
        width: 100%;
        border-right: none;
        padding-right: 0;
    }

    .wiki-editor-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        padding: 20px;
        overflow-y: auto;
        overflow-x: visible;
    }

    .editor-active .wiki-editor-container {
        transform: translateX(0);
        display: flex !important;
    }

    .editor-active .wiki-sidebar {
        opacity: 0;
        pointer-events: none;
    }

    #editorjs {
        min-height: 360px;
        padding-left: 0;
        padding-right: 0;
        overflow: visible;
    }

    #editorjs .codex-editor,
    #editorjs .codex-editor__redactor {
        overflow: visible;
    }

    #editorjs .ce-block__content,
    #editorjs .ce-toolbar__content {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    #editorjs .ce-toolbar__actions {
        right: 0;
    }

    #editorjs .ce-popover {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: 88px !important;
        width: auto !important;
        max-width: none;
        max-height: min(420px, calc(100vh - 140px));
        overflow-y: auto;
    }

    .wiki-title-row {
        display: block;
    }

    .wiki-title-wrap {
        display: flex;
        flex-direction: column;
        padding-right: 0;
    }

    .wiki-project-control {
        position: static;
        justify-content: flex-end;
        margin-bottom: 10px;
        order: -1;
    }

    .wiki-project-select {
        width: min(220px, 100%);
        min-width: 0;
    }
}

/* === ARCHIVE PAGE STYLES === */
.archive-dashboard {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.archive-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.archive-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.archive-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.archive-stat-info .stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-2);
}

.archive-stat-info .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-1);
}

.inspiration-box {
    background: linear-gradient(135deg, #1e1e2e 0%, #11111d 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 32px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 200px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    overflow: hidden;
}

.inspiration-box::before {
    content: '"';
    position: absolute;
    top: -20px;
    left: 20px;
    font-size: 120px;
    color: rgba(255,255,255,0.05);
    font-family: serif;
}

.inspiration-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--blue);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.inspiration-content #inspiration-text {
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 12px;
    font-style: italic;
}

.inspiration-content #inspiration-date {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}

.inspiration-refresh {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.inspiration-refresh:hover {
    background: var(--blue);
    transform: rotate(180deg);
}

.archive-list-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.archive-item {
    padding: 16px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.archive-item:hover {
    border-color: var(--blue);
    transform: translateX(4px);
}

.archive-item-info h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
    color: var(--text-1);
}

.archive-item-info p {
    font-size: 0.8rem;
    color: var(--text-3);
}

.archive-item-actions {
    display: flex;
    gap: 8px;
}

.archive-btn {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: none;
}

.restore-btn {
    background: var(--blue);
    color: #fff;
}

.del-perm-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

@media (max-width: 768px) {
    .archive-dashboard {
        grid-template-columns: 1fr;
    }
}

/* === REMINDER STYLES === */
.due-today-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 4px;
    margin-left: 10px;
    text-transform: uppercase;
    border: 1px solid rgba(239, 68, 68, 0.2);
    vertical-align: middle;
    animation: pulse-red 2.5s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

#dash-reminders-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dash-reminder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.dash-reminder-item:hover {
    border-color: var(--border);
    transform: translateX(4px);
    background: var(--surface);
}

.reminder-text {
    font-size: 0.9rem;
    font-weight: 500;
}

.reminder-date {
    font-size: 0.75rem;
    color: var(--red);
    font-weight: 600;
}

/* === ARCHIVE VAULT STYLES === */
.archive-task-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.archive-task-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    border-color: var(--blue);
}

.archive-item-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.archive-item-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-1);
}

.archive-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-2);
}

.archive-status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
}

.status-completed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--green);
}

.status-pending {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-2);
}

.archive-item-actions {
    display: flex;
    gap: 8px;
}

.archive-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.archive-btn:hover {
    background: var(--bg);
    color: var(--text-1);
    border-color: var(--text-1);
}

.restore-btn:hover {
    color: var(--blue);
    border-color: var(--blue);
    background: rgba(37, 99, 235, 0.05);
}

.del-perm-btn:hover {
    color: var(--red);
    border-color: var(--red);
    background: rgba(239, 68, 68, 0.05);
}

/* === BOOKMARK STYLES === */
.bookmark-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bookmark-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
    border-color: var(--blue);
}

.bm-main {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 4px;
}

.bm-favicon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bg);
    padding: 8px;
    border: 1px solid var(--border);
    object-fit: contain;
}

.bm-info {
    flex: 1;
    overflow: hidden;
}

.bm-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-1);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bm-url {
    font-size: 0.85rem;
    color: var(--text-2);
    text-decoration: none;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.bm-tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 3px 10px;
    background: rgba(37, 99, 235, 0.08);
    color: var(--blue);
    border-radius: 6px;
    margin-right: 6px;
    font-weight: 600;
    border: 1px solid rgba(37, 99, 235, 0.15);
}
