:root {
    --background: #f8f7f4;
    --foreground: #1c1917;
    --card: #ffffff;
    --card-foreground: #1c1917;
    --popover: #ffffff;
    --popover-foreground: #1c1917;
    --primary: #C5A467;
    --primary-foreground: #ffffff;
    --secondary: #f0efec;
    --secondary-foreground: #57534e;
    --muted: #f0efec;
    --muted-foreground: #78716c;
    --accent: #eef1f8;
    --accent-foreground: #1c1917;
    --destructive: #dc2626;
    --destructive-foreground: #f8fafc;
    --border: #e7e5e2;
    --input: #d6d3ce;
    --ring: #C5A467;
    --radius: 0.5rem;
}

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

body {
    font-family: var(--font-sans, 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════
   APP SHELL - 3-COLUMN ARCHITECTURE
   ═══════════════════════════════════════════════════ */
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* ── LEFT SIDEBAR (Icon Only Navigation) ── */
.note-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 64px; /* w-16 */
    height: 100vh;
    background-color: var(--background);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    z-index: 50;
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 32px;
}

.sidebar-logo-icon i {
    width: 28px;
    height: 28px;
    color: var(--primary);
    stroke-width: 2.5;
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 8px 0;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nav-btn:hover {
    background: var(--muted);
    color: var(--foreground);
}

.nav-btn.active {
    background: var(--secondary);
    color: var(--foreground);
    font-weight: 600;
}

.nav-btn.active::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: var(--primary);
    border-radius: 4px;
}

.nav-btn i {
    width: 22px;
    height: 22px;
}

.sidebar-text {
    display: none;
}

/* Tooltip on hover */
.nav-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
}
.tooltip {
    position: absolute;
    left: 56px;
    top: 50%;
    transform: translate(-10px, -50%);
    background: var(--foreground);
    color: var(--background);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    white-space: nowrap;
    z-index: 100;
}

/* User Avatar Bottom */
.user-info-btn {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 16px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--secondary);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}
.user-details { display: none; }

/* ── CENTER COLUMN ── */
.center-column {
    flex: 1;
    min-height: 100vh;
    padding-left: 64px; /* Match left sidebar width */
    padding-right: 240px; /* Match right sidebar width */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-content {
    width: 100%;
    max-width: 680px;
    padding: 12px 16px;
}

/* ── RIGHT CONTEXTUAL SIDEBAR ── */
.right-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 240px;
    height: 100vh;
    background: var(--background);
    border-left: 1px solid var(--border);
    padding: 20px 14px;
    overflow-y: auto;
    z-index: 40;
}

/* ═══════════════════════════════════════════════════
   VIEW MODES
   ═══════════════════════════════════════════════════ */
.view-mode {
    display: none;
    width: 100%;
    animation: fadeIn 0.3s ease;
}

.view-mode.active {
    display: block;
}

.page-section {
    display: none;
}
.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
}
.search-box {
    position: relative;
    width: 240px;
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted-foreground);
}
.search-box input {
    width: 100%;
    padding: 10px 10px 10px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--secondary);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}
.search-box input:focus {
    background: var(--card);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* ═══════════════════════════════════════════════════
   COMPOSER
   ═══════════════════════════════════════════════════ */
.composer {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-xs, 0 1px 3px rgba(0,0,0,0.05));
}
.composer-textarea {
    width: 100%;
    border: none;
    resize: none;
    outline: none;
    font-family: inherit;
    font-size: 0.875rem;
    background: transparent;
    color: var(--foreground);
    min-height: 36px;
}
.composer-textarea::placeholder {
    color: var(--muted-foreground);
}
.composer-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}
.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.visibility-select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--secondary);
    color: var(--foreground);
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
}
.tag-input {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    font-size: 0.875rem;
    outline: none;
    width: 120px;
}
.tag-input:focus {
    border-color: var(--primary);
}
.btn-compose {
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s;
}
.btn-compose:hover {
    opacity: 0.9;
}
.btn-compose i {
    width: 14px;
    height: 14px;
}
.btn-compose-sm {
    padding: 5px 12px;
    font-size: 0.75rem;
    border-radius: 6px;
}
.btn-compose-sm i {
    width: 12px;
    height: 12px;
}

/* ═══════════════════════════════════════════════════
   NOTE CARD (Component)
   ═══════════════════════════════════════════════════ */
.note-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.note-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.note-card:hover {
    box-shadow: var(--shadow-sm, 0 4px 12px rgba(0, 0, 0, 0.05));
    border-color: var(--input);
}

.note-card.pinned {
    border-left: 4px solid var(--primary);
}

.note-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.note-creator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 30px;
    height: 30px;
    background: var(--secondary);
    color: var(--muted-foreground);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

.creator-info {
    display: flex;
    flex-direction: column;
}

.creator-name {
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vis-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: 500;
}
.vis-icon.public { color: #16a34a; background: #dcfce7; }
.vis-icon.protected { color: #d97706; background: #fef3c7; }
.vis-icon.private { color: var(--muted-foreground); background: var(--muted); }
.vis-icon i { width: 12px; height: 12px; }

.creator-time {
    font-size: 0.68rem;
    color: var(--muted-foreground);
    margin-top: 1px;
}

/* Action Menu Dropdown */
.action-menu-container {
    position: relative;
}
.action-menu-trigger {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 4px;
    border-radius: 4px;
}
.action-menu-trigger:hover {
    background: var(--muted);
    color: var(--foreground);
}

.action-menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 150px;
    z-index: 100;
    padding: 4px 0;
}
.action-menu-dropdown.show {
    display: block;
}

.menu-separator { 
    height: 1px; 
    background: var(--border); 
    margin: 4px -4px; 
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--foreground);
}
.action-menu-item:hover {
    background: var(--muted);
}
.action-menu-item.danger {
    color: var(--destructive);
}
.action-menu-item.danger:hover {
    background: #fef2f2;
}
.action-menu-item i {
    width: 16px;
    height: 16px;
}

/* Note Content Formatting */
.note-body {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--foreground);
    word-wrap: break-word;
    cursor: pointer;
}
.note-body p { margin-bottom: 0.75em; }
.note-body p:last-child { margin-bottom: 0; }
.note-body a { color: var(--primary); text-decoration: none; }
.note-body a:hover { text-decoration: underline; }
.note-body pre {
    background: var(--muted);
    padding: 12px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.875rem;
    margin: 12px 0;
    border: 1px solid var(--border);
}
.note-body code {
    background: var(--muted);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.875em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.note-body pre code { background: none; padding: 0; }
.note-body blockquote {
    border-left: 3px solid var(--border);
    padding-left: 12px;
    color: var(--muted-foreground);
    margin: 12px 0;
}
.note-body ul, .note-body ol {
    margin-left: 20px;
    margin-bottom: 12px;
}
.note-body img {
    max-width: 100%;
    border-radius: var(--radius);
    margin: 12px 0;
}

/* Edit Mode */
.edit-panel { display: none; margin-top: 12px; }
.note-card.editing .note-body { display: none; }
.note-card.editing .edit-panel { display: block; }
.edit-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    resize: vertical;
    margin-bottom: 12px;
    outline: none;
    color: var(--foreground);
}
.edit-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Tags and Footer */
.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.note-tag {
    background: var(--secondary);
    color: var(--muted-foreground);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}
.note-tag:hover {
    background: var(--muted);
    border-color: var(--border);
    color: var(--foreground);
}

.note-footer {
    display: flex;
    align-items: center;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}
.footer-btn {
    background: none;
    border: none;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}
.footer-btn:hover {
    background: var(--secondary);
    color: var(--foreground);
}
.footer-btn i {
    width: 14px;
    height: 14px;
}

/* Empty States */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
    color: var(--muted-foreground);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--card);
}
.empty-state i {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-state-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 8px;
}

/* ═══════════════════════════════════════════════════
   STANDALONE DETAIL VIEW
   ═══════════════════════════════════════════════════ */
.detail-view-container {
    width: 100%;
}
.detail-header-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.btn-back {
    background: var(--card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--foreground);
    transition: background 0.2s;
}
.btn-back:hover {
    background: var(--secondary);
}
.btn-back i {
    width: 18px;
    height: 18px;
}
.detail-title-text {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Note displayed in Detail Mode */
.detail-note-card {
    border: none;
    padding: 32px 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}
.detail-note-card:hover {
    box-shadow: none;
    border-color: var(--border);
}
.detail-note-card .note-body {
    font-size: 1.0625rem;
    cursor: text;
}
.detail-note-card .note-footer { display: none; }

/* Detail Comments */
.comments-section {
    margin-top: 32px;
}
.comments-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-input-area {
    margin-bottom: 32px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.comment-input-textarea {
    width: 100%;
    min-height: 80px;
    border: none;
    resize: none;
    outline: none;
    background: transparent;
    color: var(--foreground);
    font-family: inherit;
    font-size: 0.9375rem;
}
.comment-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.comment-thread {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.comment-item {
    display: flex;
    gap: 16px;
}
.comment-content {
    flex: 1;
}
.comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.comment-author {
    font-weight: 600;
    font-size: 0.875rem;
}
.comment-time {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}
.comment-text {
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--foreground);
}
.comment-actions-bar {
    margin-top: 8px;
}
.comment-action-btn {
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
}
.comment-action-btn:hover {
    color: var(--foreground);
}


/* ═══════════════════════════════════════════════════
   RIGHT SIDEBAR (MEMO EXPLORER / MEMO DETAIL INFO)
   ═══════════════════════════════════════════════════ */
.explorer-block {
    margin-bottom: 24px;
}
.explorer-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted-foreground);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stat Calendar Box placeholder styling */
.stats-calendar {
    width: 100%;
    height: 120px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* Tags in sidebar */
.sidebar-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Metadata in Detail Sidebar */
.meta-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}
.meta-label {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-bottom: 4px;
}
.meta-value {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}


/* ═══════════════════════════════════════════════════
   BUTTONS & BADGES
   ═══════════════════════════════════════════════════ */
.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-secondary:hover { background: var(--muted); }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    position: absolute;
    top: 4px;
    right: 4px;
}

/* TOAST */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--foreground);
    color: var(--background);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
}
.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════
   AI CHATBOT WIDGET
   ═══════════════════════════════════════════════════ */
.chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.2s;
}
.chat-fab:hover { transform: scale(1.05); }
.chat-fab i { width: 24px; height: 24px; }
.chat-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: 500px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.chat-panel.expanded {
    width: 600px;
    height: 80vh;
}


/* ═══════════════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .center-column {
        padding-right: 0;
    }
    .right-sidebar {
        display: none;
    }
}

@media (max-width: 768px) {
    .center-column {
        padding-left: 0;
    }
    .note-sidebar {
        display: none; 
    }
    .chat-panel {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    .chat-panel.expanded {
        width: 100%;
        height: 100%;
    }
}

/* ═══════════════════════════════════════════════════
   SHARED / READ-ONLY MODE
   When someone receives a ?memo=UID link, they only
   see the specific memo — no sidebar, no composer,
   no tab navigation.
   ═══════════════════════════════════════════════════ */
.app-shell.shared-mode .note-sidebar {
    display: none !important;
}
.app-shell.shared-mode .right-sidebar {
    display: none !important;
}
.app-shell.shared-mode .center-column {
    padding-left: 0;
    padding-right: 0;
}
.app-shell.shared-mode .main-content {
    max-width: 720px;
    margin: 0 auto;
}
.app-shell.shared-mode .chat-fab {
    display: none !important;
}
.app-shell.shared-mode .chat-panel {
    display: none !important;
}

/* Shared header banner */
.shared-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-bottom: 1px solid #fcd34d;
    font-size: 0.8rem;
    color: #92400e;
    gap: 8px;
}
.shared-banner i {
    width: 16px;
    height: 16px;
}
.shared-banner a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════
   ACTIVITY CALENDAR HEATMAP (CuCu Note Style)
   ═══════════════════════════════════════════════════ */
.activity-calendar {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--card);
    margin-bottom: 16px;
}
.activity-calendar .cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.activity-calendar .cal-header .cal-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--foreground);
    letter-spacing: -0.01em;
}
.activity-calendar .cal-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
.activity-calendar .cal-nav button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    transition: all 0.15s;
}
.activity-calendar .cal-nav button:hover {
    background: var(--secondary);
    color: var(--foreground);
}
.activity-calendar .cal-nav button:disabled {
    opacity: 0.3;
    cursor: default;
}
.activity-calendar .cal-nav button i {
    width: 16px;
    height: 16px;
}
.cal-nav .cal-month-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--foreground);
    min-width: 80px;
    text-align: center;
}

/* Weekday header row */
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}
.cal-weekdays span {
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 0;
    opacity: 0.6;
}
.cal-weekdays span.weekend {
    color: #f87171;
    opacity: 0.5;
}

/* Day grid */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    border-radius: 6px;
    cursor: default;
    transition: all 0.15s;
    user-select: none;
    position: relative;
}
.cal-cell:hover {
    transform: scale(1.15);
    z-index: 5;
}
.cal-cell.outside {
    color: var(--muted-foreground);
    opacity: 0.2;
}
.cal-cell.empty {
    background: var(--secondary);
    color: var(--muted-foreground);
    opacity: 0.5;
}
.cal-cell.today {
    outline: 2px solid var(--primary, #C5A467);
    outline-offset: 1px;
    font-weight: 700;
    z-index: 2;
}
.cal-cell.weekend {
    color: #f87171;
    opacity: 0.7;
}

/* Intensity levels — gold warm palette (matching theme) */
.cal-cell.lvl-0 { background: var(--secondary); color: var(--muted-foreground); }
.cal-cell.lvl-1 { background: #f5f0e1; color: #8B7355; }
.cal-cell.lvl-2 { background: #e8d5a8; color: #6B5B3E; }
.cal-cell.lvl-3 { background: linear-gradient(135deg, #C5A467, #B8944A); color: #fff; font-weight: 600; }
.cal-cell.lvl-4 { background: linear-gradient(135deg, #A88B4A, #8B7335); color: #fff; font-weight: 700; box-shadow: 0 2px 4px rgba(197, 164, 103, 0.4); }

/* Legend bar */
.cal-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.6rem;
    color: var(--muted-foreground);
    opacity: 0.7;
}
.cal-legend .cal-legend-blocks {
    display: flex;
    gap: 3px;
    align-items: center;
}
.cal-legend .cal-legend-block {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ═══════════════════════════════════════════════════
   SHARED / READ-ONLY MODE
   When ?shared=1 — external user sees ONLY the shared memo
   ═══════════════════════════════════════════════════ */
.shared-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: #fef3c7;
    border-bottom: 1px solid #fbbf24;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #92400e;
}
.shared-banner i {
    width: 16px;
    height: 16px;
    color: #d97706;
}
.shared-banner a {
    color: #1d4ed8;
    text-decoration: underline;
    margin-left: 4px;
}

/* Hide everything except the memo content */
.shared-mode .note-sidebar {
    display: none !important;
}
.shared-mode .right-sidebar {
    display: none !important;
}
.shared-mode .center-column {
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.shared-mode .main-content {
    max-width: 720px;
    margin: 0 auto;
    padding-top: 50px; /* space for the fixed banner */
}
.shared-mode .composer-box {
    display: none !important;
}
.shared-mode .topbar {
    display: none !important;
}
.shared-mode #chatFab {
    display: none !important;
}
.shared-mode #chatPanel {
    display: none !important;
}
.shared-mode .action-menu-container {
    display: none !important;
}
.shared-mode .note-footer {
    display: none !important;
}



