/* ==========================================
   ONode - Toss Minimalist Style
   ========================================== */

/* Pretendard Font */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css');

/* CSS Variables - Light Mode (Default) */
:root {
    --bg-primary: #E9EBEE;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E0E2E6;
    --bg-input: #F2F4F6;
    --text-primary: #191F28;
    --text-secondary: #4E5968;
    --text-tertiary: #8B95A1;
    --accent: #3182F6;
    --accent-hover: #1b64da;
    --accent-light: rgba(49, 130, 246, 0.08);
    --accent-lighter: rgba(49, 130, 246, 0.15);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-card-hover: 0 8px 28px rgba(0, 0, 0, 0.12);
    --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.15);
    --border-color: rgba(0, 0, 0, 0.08);
    --card-border: 1px solid rgba(0, 0, 0, 0.1);
    --danger: #F04452;
    --danger-hover: #D9304A;
    --success: #03B26C;
    --snap-grid: 40px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
}

/* Dark Mode - Toss Style */
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #000000;
    --bg-card: #2c2929;
    /* Slightly lighter gray for cards */
    --bg-tertiary: #1c1c1e;
    --bg-input: #1c1c1e;
    --text-primary: #ffffff;
    --text-secondary: #adb5bd;
    --text-tertiary: #6b7684;
    --accent: #3182f6;
    --accent-hover: #4e95ff;
    --accent-light: rgba(49, 130, 246, 0.15);
    --accent-lighter: rgba(49, 130, 246, 0.25);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-card-hover: 0 12px 32px rgba(0, 0, 0, 0.6);
    --shadow-float: 0 20px 60px rgba(0, 0, 0, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --card-border: none;
}

[data-theme="dark"] .card {
    background-color: #313133 !important;
}

/* Dark Mode Button Unity */
[data-theme="dark"] .header {
    background: #000000 !important;
}

[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-ghost {
    background: #1c1c1e !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn-ghost:hover {
    background: #2c2c2e !important;
}

[data-theme="dark"] .btn-primary {
    background: var(--accent);
    color: #ffffff;
}

[data-theme="dark"] .btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 15px rgba(49, 130, 246, 0.4);
}

[data-theme="dark"] .card-delete {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   Reset & Base
   ========================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    min-width: 900px;
    transition: background-color var(--transition-slow), color var(--transition-slow);
    user-select: none;
}

/* ==========================================
   Header / Toolbar
   ========================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: background-color var(--transition-slow), border-color var(--transition-slow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: opacity var(--transition-fast);
}

.logo:hover {
    opacity: 0.7;
}

.logo:active {
    transform: scale(0.96);
}

.logo-text {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition-fast);
}

.logo-icon img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    transition: color var(--transition-slow);
}

/* Header Utils (Share & Download) */
.header-utils {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    margin-right: 8px;
    padding-left: 12px;
    border-left: 1px solid var(--border-color);
}

.header-utils .btn {
    font-size: 12px;
    padding: 6px 10px;
    white-space: nowrap;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.header-utils .btn:hover {
    opacity: 1;
}

/* Search Bar */
.search-container {
    position: relative;
    flex: 0 1 420px;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 42px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-normal);
}

.search-input::placeholder {
    color: var(--text-tertiary);
    font-weight: 400;
}

.search-input:focus {
    border-color: var(--accent);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 16px;
    pointer-events: none;
    transition: color var(--transition-normal);
}

.search-input:focus+.search-icon,
.search-input:focus~.search-icon {
    color: var(--accent);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast);
    font-size: 11px;
    color: var(--text-secondary);
}

.search-container.has-value .search-clear {
    opacity: 1;
}

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 12px;
    height: 32px;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(49, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-secondary:hover {
    background: var(--accent-lighter);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--accent);
    color: white;
}

.btn-danger:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(49, 130, 246, 0.3);
}

.btn-icon {
    width: 38px;
    padding: 0;
    font-size: 18px;
}

/* Login Button */
.btn-login {
    background: white;
    color: #333;
    border: 1px solid var(--border-color);
    gap: 8px;
    padding: 0 14px;
    height: 36px;
    font-size: 13px;
    font-weight: 500;
}

.btn-login:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .btn-login {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .btn-login:hover {
    background: var(--bg-secondary);
}

/* Plan Button */
.btn-plan {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 12px;
    font-weight: 700;
    gap: 5px;
    padding: 0 12px;
    height: 30px;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
    transition: all var(--transition-fast);
    opacity: 1 !important;
}

.btn-plan:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.5);
    opacity: 1 !important;
}

.btn-plan:active {
    transform: scale(0.96);
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Theme Toggle */
.theme-toggle {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background var(--transition-normal);
    flex-shrink: 0;
}

.theme-toggle::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-normal);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .theme-toggle {
    background: var(--accent);
}

[data-theme="dark"] .theme-toggle::after {
    transform: translateX(24px);
}

.theme-toggle-icons {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}



.toggle-switch {
    width: 52px;
    height: 28px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background var(--transition-normal);
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    top: 3px;
    left: 3px;
    transition: transform var(--transition-normal);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.toggle-switch.active {
    background: var(--accent);
}

.toggle-switch.active::after {
    transform: translateX(24px);
}

.toggle-switch-icons {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    pointer-events: none;
    z-index: 1;
}

/* ==========================================
   Sheet Bar
   ========================================== */
.sheet-bar-container {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    height: 48px;
    display: flex;
    align-items: center;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: background-color var(--transition-slow);
}

[data-theme="dark"] .sheet-bar-container {
    background: #000000 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sheet-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.sheet-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sheet-tabs::-webkit-scrollbar {
    display: none;
}

.sheet-tab {
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    user-select: none;
}

.sheet-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sheet-tab.active {
    background: var(--accent);
    color: #ffffff;
}

.add-sheet-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.add-sheet-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
    transform: scale(1.1);
}

/* ==========================================
   Canvas
   ========================================== */
.canvas {
    position: fixed;
    top: 112px;
    /* 64px header + 48px sheet-bar */
    left: 0;
    right: 0;
    bottom: 0;
    overflow-x: auto;
    overflow-y: auto;
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(circle, var(--border-color) 1px, transparent 1px);
    background-size: 40px 40px;
    transition: background-color var(--transition-slow);
    cursor: default;
}

.canvas-inner {
    position: relative;
    min-width: 100%;
    min-height: 100%;
}

/* ==========================================
   Cards (Bookmarks & Notes)
   ========================================== */
.card {
    position: absolute;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: var(--card-border, none);
    cursor: default;
    transition: box-shadow var(--transition-normal), background-color var(--transition-slow), opacity var(--transition-normal), transform 0.08s ease;
    z-index: 1;
    overflow: visible;
}

.card-drag-handle {
    width: 100%;
    height: 18px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: transparent;
    transition: background var(--transition-fast);
    z-index: 10;
}

.card-drag-handle::after {
    content: '';
    width: 32px;
    height: 4px;
    border-radius: 4px;
    background: var(--border-color);
    opacity: 0.5;
    transition: all var(--transition-fast);
}

.card-drag-handle:hover {
    background: rgba(0, 0, 0, 0.04);
}

.card-drag-handle:hover::after {
    opacity: 1;
    background: var(--text-tertiary);
    width: 40px;
}

[data-theme="dark"] .card-drag-handle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.card-drag-handle:hover {
    background: rgba(0, 0, 0, 0.04);
}

.card-drag-handle:hover::after {
    background: var(--text-tertiary);
}

.card-drag-handle:active {
    cursor: grabbing;
}



/* ==========================================
   Table Card
   ========================================== */
.table-card {
    min-width: 20px;
    min-height: 10px;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 18px 18px 0 0;
    min-height: 0;
}

.table-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-main);
    outline: none;
}

.table-actions {
    display: flex;
    gap: 4px;
}

.table-content {
    flex: 1;
    overflow: hidden !important;
    padding: 0;
    position: relative;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.table-content::-webkit-scrollbar {
    display: none;
}

.canvas-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    transform-origin: top left;
}

.canvas-table tr {
    overflow: hidden;
}

.canvas-table td {
    border: 1px solid #000000;
    padding: 0;
    font-size: 13px;
    line-height: 1;
    color: var(--text-main);
    text-align: center;
    background: var(--bg-card);
    transition: background 0.2s;
    outline: none;
    min-width: 1px;
    min-height: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.canvas-table td:focus {
    background: rgba(49, 130, 246, 0.05);
    border-color: var(--accent);
}

/* Connection Label */
.connection-label {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    z-index: 50;
    transform: translate(-50%, -50%);
    cursor: text;
    pointer-events: auto;
}

.connection-label:focus {
    outline: 2px solid var(--accent);
    z-index: 100;
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
    z-index: 10;
}

.card.dragging {
    box-shadow: var(--shadow-float);
    cursor: grabbing;
    z-index: 999;
    opacity: 0.92;
    border-color: var(--accent);
    transition: box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.card.hidden-by-search {
    opacity: 0.08;
    pointer-events: none;
    transform: scale(0.97);
}

.card.highlight-search {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-card-hover);
}

.card.selected-card {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent), 0 0 12px rgba(49, 130, 246, 0.35), var(--shadow-card-hover);
    z-index: 15;
}

/* Card Enter Animation */
@keyframes cardEnter {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.card.entering {
    animation: cardEnter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ==========================================
   Bookmark Card
   ========================================== */
.bookmark-card {
    width: auto;
    min-width: 40px;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    text-align: left;
    overflow: visible;
    cursor: default;
}

/* Wrapper for bookmark content (favicon + info) */
.bookmark-content-wrapper {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 4px 8px;
}



.bookmark-card .bookmark-info {
    width: auto;
    flex: 1;
    padding: 2px 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
    text-align: center;
    min-width: 0;
}

.bookmark-card .bookmark-title {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    width: 100%;
    padding: 2px 0;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Compact (No description) - Horizontal Layout */
.bookmark-card.compact-card .bookmark-content-wrapper {
    align-items: center;
    padding: 6px 6px;
}





.bookmark-card.compact-card .bookmark-info {
    padding: 0;
    align-items: center;
    text-align: center;
    width: auto;
    flex: 1;
}

.bookmark-card.compact-card .bookmark-title {
    font-size: 13px;
    line-height: 1.35;
    text-align: center;
    width: auto;
    display: block;
    /* changed from webkit-box for nowrap */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bookmark-card.compact-card .bookmark-desc {
    display: none;
}

/* Place Card (Travel/Maps) */
.bookmark-card.place-card {
    min-width: 240px;
    min-height: 100px;
    padding: 0;
    overflow: visible;
}

.bookmark-card.place-card .bookmark-content-wrapper {
    flex-direction: column;
    padding: 0;
}

.bookmark-card.place-card .bookmark-info {
    padding: 20px 20px;
    align-items: center;
    text-align: center;
    width: 100%;
}

.place-tag {
    font-size: 10px;
    font-weight: 800;
    color: var(--accent);
    background: var(--accent-light);
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.bookmark-card.place-card .bookmark-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center !important;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: normal;
}

.bookmark-card.place-card .bookmark-desc {
    display: block !important;
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center !important;
    line-height: 1.5;
    opacity: 0.85;
    white-space: normal;
    background: none;
    padding: 0;
    margin-top: 4px;
}

.bookmark-card.place-card .place-image-container {
    width: 100%;
    height: 160px;
    background: var(--bg-tertiary);
    overflow: hidden;
    position: relative;
    border-top: 1px solid var(--border-color);
}

.bookmark-card.place-card .place-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bookmark-card.place-card .place-map-overlay {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #3182F6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* No Favicon */
.bookmark-card.no-favicon {
    text-align: center;
}

.bookmark-card.no-favicon .bookmark-content-wrapper {
    padding: 8px 12px !important;
    flex-direction: column;
    align-items: center;
}

.bookmark-card.no-favicon .bookmark-info {
    padding: 0 !important;
    align-items: center;
    text-align: center;
}

.bookmark-card.no-favicon .bookmark-title {
    text-align: center;
    white-space: normal;
}

/* Favicon Placeholder */
.favicon-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.bookmark-card.compact-card .favicon-placeholder {
    font-size: 10px;
}

.bookmark-favicon {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform var(--transition-normal), background-color var(--transition-slow);
    flex-shrink: 0;
}

.bookmark-card:hover .bookmark-favicon {
    transform: scale(1.08);
}

.bookmark-favicon img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.bookmark-favicon .favicon-placeholder {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
}

.bookmark-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.bookmark-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--transition-slow);
    text-align: center;
    width: 100%;
}

.bookmark-url {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--transition-slow);
}

.bookmark-desc {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 4px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    width: 100%;
    word-break: break-all;
    white-space: pre-wrap;
    text-align: center;
    transition: color var(--transition-slow), background-color var(--transition-slow);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    cursor: pointer;
}

/* Edge resize handles */
.edge-resize {
    position: absolute;
    z-index: 2;
    opacity: 0;
}

.bookmark-card:hover .edge-resize,
.note-card:hover .edge-resize,
.image-card:hover .edge-resize {
    opacity: 1;
}

.edge-n {
    top: -7px;
    left: 12px;
    right: 12px;
    height: 14px;
    cursor: ns-resize;
}

.edge-s {
    bottom: -7px;
    left: 12px;
    right: 12px;
    height: 14px;
    cursor: ns-resize;
}

.edge-w {
    left: -7px;
    top: 12px;
    bottom: 12px;
    width: 14px;
    cursor: ew-resize;
}

.edge-e {
    right: -7px;
    top: 12px;
    bottom: 12px;
    width: 14px;
    cursor: ew-resize;
}

.edge-nw {
    top: -8px;
    left: -8px;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
}

.edge-ne {
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    cursor: nesw-resize;
}

.edge-sw {
    bottom: -8px;
    left: -8px;
    width: 18px;
    height: 18px;
    cursor: nesw-resize;
}

.edge-se {
    bottom: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
}

.bookmark-link-btn {
    width: 100%;
    height: 34px;
    margin-top: 4px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    border: none;
    color: var(--accent);
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.bookmark-link-btn:hover {
    background: var(--accent);
    color: white;
}

.bookmark-link-btn:active {
    transform: scale(0.96);
}

/* Card Order Badge */
.card-order-badge {
    position: absolute;
    top: -9px;
    left: -9px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: white;
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    cursor: text;
    z-index: 5;
    opacity: 0;
    transform: scale(0.7);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.card-order-badge:focus,
.card-order-badge:not(:placeholder-shown) {
    opacity: 1;
    transform: scale(1);
    outline: none;
}

.card:hover .card-order-badge {
    opacity: 0.6;
    transform: scale(1);
}

.card:hover .card-order-badge:hover,
.card-order-badge:focus {
    opacity: 1;
}

/* Card Delete Button */
.card-delete {
    position: absolute;
    top: -9px;
    right: -9px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: white;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.7);
    transition: all var(--transition-fast);
    z-index: 5;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.card:hover .card-delete {
    opacity: 1;
    transform: scale(1);
}

.card-delete:hover {
    background: #F04452;
    transform: scale(1.15) !important;
    box-shadow: 0 3px 10px rgba(240, 68, 82, 0.3);
}

/* ==========================================
   Note Card
   ========================================== */
.note-card {
    width: 210px;
    height: 200px;
    display: flex;
    flex-direction: column;
}

.note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
}

.note-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-icon {
    font-size: 16px;
}

.note-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color var(--transition-slow);
}

.note-timestamp {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: color var(--transition-slow);
}

.note-textarea {
    flex: 1;
    padding: 6px 18px 18px;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.7;
    color: var(--text-primary);
    min-height: 60px;
    transition: color var(--transition-slow);
    /* Custom scrollbar - Firefox */
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.note-textarea:hover {
    scrollbar-color: rgba(150, 150, 150, 0.3) transparent;
}

/* Custom scrollbar - Webkit (Chrome, Edge, Safari) */
.note-textarea::-webkit-scrollbar {
    width: 4px;
}

.note-textarea::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}

.note-textarea::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    transition: background 0.3s;
}

.note-textarea:hover::-webkit-scrollbar-thumb {
    background: rgba(150, 150, 150, 0.3);
}

.note-textarea:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(150, 150, 150, 0.5);
}

.note-textarea::placeholder {
    color: var(--text-tertiary);
}

/* ==========================================
   Modals
   ========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow-float);
    transform: scale(0.92) translateY(20px);
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    transition: color var(--transition-slow);
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
    transition: color var(--transition-slow);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    transition: color var(--transition-slow);
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--bg-input);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-normal);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-light);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.modal-actions .btn {
    flex: 1;
    height: 44px;
    font-size: 14px;
}

.form-group-inline {
    display: flex;
    align-items: center;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition-slow);
}

.form-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ==========================================
   Empty State
   ========================================== */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.empty-state-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    transition: color var(--transition-slow);
}

.empty-state-desc {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    transition: color var(--transition-slow);
}

/* ==========================================
   Toast Notification
   ========================================== */
.toast-container {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.toast {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 12px 22px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    animation: toastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    white-space: nowrap;
}

.toast.removing {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.9);
    }
}

/* ==========================================
   Context Menu
   ========================================== */
.dark-mode .canvas-table td {
    border-color: #555555;
}

.context-menu {
    position: fixed;
    min-width: 180px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-float);
    border: 1px solid var(--border-color);
    padding: 6px;
    z-index: 1500;
    opacity: 0;
    transform: scale(0.95);
    visibility: hidden;
    transition: all 0.12s ease;
}

.context-menu.active {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-family);
    transition: background var(--transition-fast), color var(--transition-slow);
}

.context-menu-item:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.context-menu-item.danger:hover {
    background: rgba(240, 68, 82, 0.08);
    color: var(--danger);
}

.context-menu-item .menu-icon,
.context-menu-item .ctx-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 15px;
    flex-shrink: 0;
    /* Force emoji to render at consistent size */
    font-variant-emoji: emoji;
    line-height: 1;
}

.context-menu-item .ctx-label {
    flex: 1;
    text-align: left;
}

.context-menu-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 8px;
}

/* ==========================================
   Scrollbar
   ========================================== */
.canvas::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.canvas::-webkit-scrollbar-track {
    background: transparent;
}

.canvas::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
    opacity: 0.3;
}

.canvas::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
        height: 56px;
    }

    .logo-text {
        display: none;
    }

    .search-container {
        flex: 1;
    }

    .canvas {
        top: 56px;
    }

    .btn:not(.btn-icon) span {
        display: none;
    }

    .btn:not(.btn-icon) {
        width: 38px;
        padding: 0;
    }
}

/* ==========================================
   Selection / Utility
   ========================================== */
::selection {
    background: var(--accent-lighter);
    color: var(--text-primary);
}

.note-textarea::selection,
.form-input::selection,
.search-input::selection {
    background: var(--accent-lighter);
}

/* Resize handle for notes */
.note-card .note-resize {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    cursor: se-resize;
    opacity: 0;
    transition: opacity var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-tertiary);
}

.note-card:hover .note-resize {
    opacity: 0.6;
}

.note-card:hover .note-resize:hover {
    opacity: 1;
}

/* ==========================================
   SVG Connections
   ========================================== */
.connections-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

.connection-line {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    opacity: 0.8;
    transition: opacity var(--transition-fast), stroke var(--transition-slow);
}

.connection-line:hover {
    stroke-width: 6;
    opacity: 0.9;
    pointer-events: stroke;
}

.connection-line.selected {
    stroke-width: 3;
    opacity: 1;
    stroke-dasharray: 8 4;
    animation: dashFlow 0.6s linear infinite;
}

@keyframes dashFlow {
    to {
        stroke-dashoffset: -12;
    }
}

.connection-dot {
    r: 4;
    fill: var(--accent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.connection-line:hover~.connection-dot,
.connection-group:hover .connection-dot {
    opacity: 0.8;
}

/* Connection Mode */
.connect-mode-active {
    cursor: crosshair !important;
}

.connect-mode-active .card {
    cursor: pointer !important;
}

.connect-mode-active .card:hover {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-card-hover) !important;
}

.card.connect-selected {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px var(--accent-lighter), var(--shadow-card-hover) !important;
}

.btn.connect-active {
    background: var(--accent) !important;
    color: white !important;
}

/* ==========================================
   Table Advanced Features
   ========================================== */
.canvas-table td.selected {
    background: rgba(49, 130, 246, 0.2) !important;
    outline: 2px solid var(--accent);
    z-index: 2;
}

.canvas-table td {
    position: relative;
}

.col-resizer,
.row-resizer {
    position: absolute;
    background: transparent;
    z-index: 10;
}

.col-resizer {
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
}

.row-resizer {
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 6px;
    cursor: row-resize;
}

.col-resizer:hover,
.row-resizer:hover {
    background: var(--accent);
    opacity: 0.5;
}

/* Connection Points */
.card .connect-point {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--accent);
    border: 2px solid white;
    border-radius: 50%;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    cursor: crosshair;
}

.card:hover .connect-point,
.card.connect-selected .connect-point,
.connect-mode-active .card .connect-point {
    opacity: 1;
}

.card .connect-point.active {
    opacity: 1;
    transform: scale(1.5);
    background: #FF9500;
    /* Distinct color for active starting point */
    border-color: white;
    box-shadow: 0 0 8px rgba(255, 149, 0, 0.6);
}

.card .connect-point:hover {
    background: var(--accent);
}

.connect-point.pt-top {
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
}

.connect-point.pt-top:hover {
    transform: translateX(-50%);
}

.connect-point.pt-bottom {
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
}

.connect-point.pt-bottom:hover {
    transform: translateX(-50%);
}

.connect-point.pt-left {
    left: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.connect-point.pt-left:hover {
    transform: translateY(-50%);
}

.connect-point.pt-right {
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
}

.connect-point.pt-right:hover {
    transform: translateY(-50%);
}

/* Connection Labels */
.connection-label {
    position: absolute;
    transform: translate(-50%, -50%);
    background: var(--bg-card, var(--bg-secondary));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 3px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    white-space: nowrap;
    min-width: 20px;
    text-align: center;
    outline: none;
    pointer-events: auto;
    cursor: text;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.connection-label:empty:not(:focus) {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.8);
}

.connection-label:focus {
    opacity: 1;
    pointer-events: auto;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%) scale(1.05);
}



/* ==========================================
   Widgets (Clock, Calendar)
   ========================================== */
.widget-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 200px;
    box-shadow: var(--shadow-card);
    border: none;
    overflow: visible;
    transition: box-shadow var(--transition-normal), background-color var(--transition-slow);
}

[data-theme="dark"] .widget-card {
    background-color: #313133 !important;
}

.widget-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 16px 16px;
}

/* Digital Clock */
.clock-widget {
    width: 200px;
    height: 90px;
}

.clock-time {
    font-size: 30px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    letter-spacing: -1px;
    white-space: nowrap;
    text-align: center;
    line-height: 1;
}

.clock-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Dark mode: time white, date sky blue */
[data-theme="dark"] .clock-time {
    color: #ffffff;
}

[data-theme="dark"] .clock-date {
    color: #ffffff;
}

/* D-Day Widget */
.dday-widget {
    width: 200px;
    height: 90px;
}

.dday-container {
    text-align: center;
}

.dday-days {
    font-size: 30px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
    white-space: nowrap;
    line-height: 1;
}

.dday-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

[data-theme="dark"] .dday-days {
    color: #ffffff;
}

[data-theme="dark"] .dday-date {
    color: var(--accent);
}



/* Quote Widget */
.quote-widget {
    width: 200px;
    height: 200px;
    text-align: center;
}

.quote-container {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.quote-category {
    display: none !important;
}

.quote-text {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    color: var(--text-primary);
    /* Automatically adapts to Light/Dark mode */
    word-break: keep-all;
    text-align: center;
}

.quote-author {
    font-size: 13px;
    color: var(--accent);
    /* Brand color matching the clock */
    font-weight: 600;
}

/* Calculator Widget - Neutral Gray Theme */
.card.calc-widget {
    width: 200px;
    height: 200px;
    padding: 0;
    background: var(--bg-secondary);
    /* Same as other cards */
    border: none;
    box-shadow: var(--shadow-card);
    overflow: visible;
    /* Allow delete button to show outside */
    color: var(--text-primary) !important;
}

/* Dark mode: match note card color exactly */
[data-theme="dark"] .card.calc-widget {
    background: #3a3a3c !important;
}

.calc-container {
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.calc-display {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 800;
    text-align: right;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .calc-display {
    background: rgba(255, 255, 255, 0.07);
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    flex: 1;
}

.calc-btn {
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .calc-btn {
    background: rgba(255, 255, 255, 0.08);
}

.calc-btn:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.calc-btn.op {
    background: var(--accent) !important;
    color: #ffffff !important;
    border-color: var(--accent) !important;
}

.calc-btn.op:hover {
    background: var(--accent-hover) !important;
    color: #ffffff !important;
}

.calc-btn.clr {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
}

.calc-btn.clr:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}

/* Calendar Widget */
.calendar-widget {
    width: 200px;
    height: 200px;
}

.calendar-header {
    width: 100%;
    text-align: center;
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    width: 100%;
}

.calendar-day-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: center;
    font-weight: 700;
    padding-bottom: 6px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.calendar-day.today {
    background: var(--accent);
    color: white;
    font-weight: 800;
    box-shadow: 0 4px 12px var(--accent-light);
}

.calendar-day.other-month {
    opacity: 0.15;
}

/* ==========================================
   Image & Video Cards
   ========================================== */
.image-card {
    overflow: visible;
    /* Allow badge & delete outside */
    padding: 0;
    background: var(--bg-secondary);
}

.image-card img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-lg);
    pointer-events: none;
}

/* Image meta info (title, desc, url) - matches bookmark card style */
.image-meta {
    padding: 8px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}

.image-meta-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-meta-desc {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-meta-url {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* legacy caption (keep for compatibility) */
.image-caption {
    padding: 7px 12px 9px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    word-break: break-word;
    line-height: 1.4;
    background: transparent;
}

.video-card {
    width: 320px;
    height: 200px;
    padding: 0;
    overflow: hidden;
    background: black;
}

.video-card iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ==========================================
   Read-only Mode (ONode)
   ========================================== */
body.is-readonly .card-delete,
body.is-readonly .edge-resize,
body.is-readonly .connect-point,
body.is-readonly .add-sheet-btn {
    display: none !important;
}

/* 읽기 모드: drag handle은 표시하되 드래그/호버 효과 제거 */
body.is-readonly .card-drag-handle {
    cursor: default !important;
    pointer-events: none;
}

body.is-readonly .card-drag-handle:hover {
    background: transparent !important;
}

body.is-readonly .card-drag-handle:hover::after {
    width: 32px !important;
    opacity: 0.5 !important;
    background: var(--border-color) !important;
}

/* 읽기 모드: Google 계정 / 로그인 / 헤더 편집 버튼 숨기기 */
body.is-readonly #userInfo,
body.is-readonly #loginBtn,
body.is-readonly .header-utils,
body.is-readonly #langBtn,
body.is-readonly .theme-toggle {
    display: none !important;
}

/* 읽기 모드: 검색바도 숨기기 */
body.is-readonly .search-container {
    display: none !important;
}

body.is-readonly .card {
    cursor: default !important;
}

body.is-readonly .bookmark-card .bookmark-content-wrapper {
    cursor: pointer !important;
}

/* 읽기 모드: order badge(카드 숫자)는 표시 (read-only이므로 편집 불가 처리) */
body.is-readonly .card-order-badge {
    pointer-events: none;
    opacity: 0.85;
}

/* ==========================================
   Feedback Button & Modal
   ========================================== */
.btn-feedback {
    background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
    color: white !important;
    font-size: 12px;
    font-weight: 600;
    height: 30px;
    padding: 0 12px;
    gap: 5px;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(49, 130, 246, 0.3);
}

.btn-feedback:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(49, 130, 246, 0.45);
}

.btn-feedback:active {
    transform: scale(0.96) translateY(0);
}

.feedback-modal {
    width: 460px;
    padding: 28px;
}

.feedback-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
}

.feedback-modal-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-light) 0%, rgba(99, 102, 241, 0.12) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.feedback-modal-close {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.feedback-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Category Chips */
.feedback-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.feedback-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    border: 2px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.feedback-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.feedback-chip.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

/* Feedback Textarea */
.feedback-textarea {
    height: auto;
    resize: vertical;
    min-height: 100px;
    max-height: 240px;
    padding: 12px 14px;
    line-height: 1.6;
    font-family: var(--font-family);
}

/* Success State */
.feedback-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0 8px;
    gap: 12px;
    text-align: center;
}

.feedback-success-icon {
    display: none;
}

@keyframes successPop {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.feedback-success-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.feedback-success-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ==========================================
   Plan Modal
   ========================================== */
/* ==========================================
   Plan Modal ??ONode Brand Redesign
   ========================================== */

.plan-modal {
    max-width: 700px;
    width: 96vw;
    padding: 0;
    overflow: hidden;
    border-radius: 24px;
}

/* Top gradient banner */
.plan-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 28px 28px 20px;
    background: linear-gradient(135deg, #0a1628 0%, #0d1f3c 60%, #0f2d5a 100%);
    position: relative;
    overflow: hidden;
}

.plan-modal-header::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(49, 130, 246, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

.plan-modal-header::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: 20px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(49, 130, 246, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.plan-modal-header>div {
    position: relative;
    z-index: 1;
}

.plan-modal-header .modal-title {
    color: #ffffff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.plan-modal-header .modal-subtitle {
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    margin-top: 4px;
}

.plan-modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(49, 130, 246, 0.18);
    color: #7eb8ff;
    border: 1px solid rgba(49, 130, 246, 0.35);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}

[data-theme="dark"] .plan-modal-badge {
    background: rgba(49, 130, 246, 0.15);
    color: #7eb8ff;
    border-color: rgba(49, 130, 246, 0.3);
}

/* Plan cards container */
.plan-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 0;
}

@media (max-width: 520px) {
    .plan-cards {
        grid-template-columns: 1fr;
    }
}

/* Free plan card */
.plan-card {
    background: var(--bg-secondary);
    border: none;
    border-radius: 0;
    padding: 24px 28px;
    position: relative;
    transition: all var(--transition-normal);
    border-right: 1px solid var(--border-color);
}

[data-theme="dark"] .plan-card {
    background: #0d0d0d;
}

/* Pro plan card */
.plan-card-pro {
    background: linear-gradient(160deg, #040d1a 0%, #071428 50%, #0a1c3a 100%);
    border-right: none;
    border: none;
    position: relative;
    overflow: hidden;
}

.plan-card-pro::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(49, 130, 246, 0.18) 0%, transparent 70%);
    pointer-events: none;
}

.plan-card-pro::after {
    content: '';
    position: absolute;
    bottom: 20px;
    left: -20px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(49, 130, 246, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

[data-theme="dark"] .plan-card-pro {
    background: linear-gradient(160deg, #030810 0%, #050e1e 50%, #071528 100%);
}

.plan-card-popular {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #3182F6, #1b64da);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(49, 130, 246, 0.5);
    letter-spacing: 0.3px;
    z-index: 1;
}

.plan-card-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.plan-card-pro .plan-card-name {
    color: rgba(49, 130, 246, 0.8);
}

.plan-card-price {
    font-size: 32px;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -1.5px;
    margin-bottom: 2px;
    line-height: 1;
}

.plan-card-pro .plan-card-price {
    color: #ffffff;
}

.plan-card-period {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.5;
    letter-spacing: 0;
}

.plan-card-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 20px;
    margin-top: 6px;
}

.plan-card-pro .plan-card-desc {
    color: rgba(255, 255, 255, 0.4);
}

.plan-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
    padding: 0;
}

.plan-feature {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.plan-card-pro .plan-feature {
    color: rgba(255, 255, 255, 0.85);
}

.plan-feature-disabled {
    opacity: 0.3;
}

.feature-check {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: #3182F6;
}

.plan-card-pro .feature-check {
    stroke: #60a5fa;
    filter: drop-shadow(0 0 4px rgba(49, 130, 246, 0.6));
}

.feature-x {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    stroke: var(--text-tertiary);
}

/* Buttons */
.plan-btn-free {
    width: 100%;
    height: 40px;
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: not-allowed;
    opacity: 0.6;
    border: none;
}

.plan-btn-pro {
    width: 100%;
    height: 44px;
    background: linear-gradient(135deg, #3182F6 0%, #1b64da 100%);
    color: white;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 20px rgba(49, 130, 246, 0.45);
    transition: all var(--transition-fast);
    position: relative;
    z-index: 1;
    letter-spacing: 0.2px;
}

.plan-btn-pro:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(49, 130, 246, 0.6);
}

.plan-btn-pro:active {
    transform: scale(0.97);
}

.plan-coming-soon {
    text-align: center;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.25);
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

/* Footer */
.plan-footer {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    line-height: 1.7;
    padding: 16px 28px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

[data-theme="dark"] .plan-footer {
    background: #0d0d0d;
    border-color: rgba(255, 255, 255, 0.06);
}

/* ==========================================
   Login Nudge — Center Float Card
   ========================================== */

.login-nudge-card {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    z-index: 9999;
    width: 320px;
    padding: 28px 24px 24px;
    border-radius: 20px;
    background: linear-gradient(160deg, #0d1520 0%, #0a1828 60%, #071230 100%);
    border: 1px solid rgba(49, 130, 246, 0.25);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(49, 130, 246, 0.1),
        0 0 40px rgba(49, 130, 246, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    font-family: var(--font-family);
    animation: loginNudgeFadeIn 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}

.login-nudge-warning {
    border-color: rgba(49, 130, 246, 0.4);
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(49, 130, 246, 0.15),
        0 0 50px rgba(49, 130, 246, 0.12);
}

@keyframes loginNudgeFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.88);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes loginNudgeFadeOut {
    from {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    to {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.92);
    }
}

.login-nudge-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    border-radius: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.4);
    transition: all var(--transition-fast);
}

.login-nudge-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
}

.login-nudge-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(49, 130, 246, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.login-nudge-warning .login-nudge-icon {
    background: rgba(49, 130, 246, 0.15);
}

.login-nudge-title {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.login-nudge-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    white-space: pre-line;
}

.login-nudge-btn {
    margin-top: 8px;
    width: 100%;
    height: 42px;
    background: linear-gradient(135deg, #3182F6 0%, #1b64da 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font-family);
    box-shadow: 0 4px 16px rgba(49, 130, 246, 0.4);
    transition: all var(--transition-fast);
    letter-spacing: 0.1px;
}

.login-nudge-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(49, 130, 246, 0.55);
}

.login-nudge-btn:active {
    transform: scale(0.97);
}

.login-nudge-warning .login-nudge-btn {
    background: linear-gradient(135deg, #3182F6 0%, #1b64da 100%);
    box-shadow: 0 4px 16px rgba(49, 130, 246, 0.45);
}

.login-nudge-warning .login-nudge-btn:hover {
    box-shadow: 0 8px 24px rgba(49, 130, 246, 0.6);
}


.toast-login-nudge span {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
}

.toast-login-btn {
    background: #3182F6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--font-family);
    transition: background var(--transition-fast);
}

.toast-login-btn:hover {
    background: #1b64da;
}

/* ==========================================
   Login Warning Banner
   ========================================== */

.login-warning-banner {
    position: fixed;
    top: 112px;
    left: 0;
    right: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: linear-gradient(90deg, #0d1b2e 0%, #0f2040 100%);
    border-bottom: 1px solid rgba(49, 130, 246, 0.3);
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font-family);
    animation: bannerSlideDown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bannerSlideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.login-warning-banner svg {
    stroke: #60a5fa;
}

.login-warning-banner span {
    flex: 1;
    line-height: 1.4;
}

.login-warning-btn {
    background: #3182F6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    font-family: var(--font-family);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(49, 130, 246, 0.4);
}

.login-warning-btn:hover {
    background: #1b64da;
    transform: translateY(-1px);
}

.login-warning-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    font-family: var(--font-family);
    transition: color var(--transition-fast);
}

.login-warning-close:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Push canvas down when banner is shown */
.login-warning-banner~#canvas,
.login-warning-banner+.canvas {
    top: 152px !important;
}

/* ==========================================
   Todo Widget Card
   ========================================== */

.todo-widget {
    width: 220px;
    min-width: 180px;
    padding: 0 0 10px;
}

.todo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 14px 8px;
}

.todo-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.todo-progress-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    flex-shrink: 0;
    margin-left: 8px;
}

.todo-progress-bar {
    height: 3px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 14px 10px;
}

.todo-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3182F6, #60a5fa);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.todo-list {
    list-style: none;
    padding: 0 10px;
    margin: 0 0 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 360px;
    overflow-y: auto;
}

.todo-list::-webkit-scrollbar {
    width: 3px;
}

.todo-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    border-radius: 8px;
    transition: background var(--transition-fast);
}

.todo-item:hover {
    background: var(--bg-secondary);
}

.todo-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: all var(--transition-fast);
    color: transparent;
}

.todo-check svg {
    width: 10px;
    height: 10px;
}

/* Completed item: badge turns grey */
.todo-num-badge.done {
    background: var(--text-tertiary) !important;
    color: #fff !important;
    opacity: 0.6;
    margin-right: 8px;
}

/* Completed text: strikethrough */
.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--text-tertiary);
    opacity: 0.6;
}

/* Hover on todo item same as clip */
.todo-item:hover .todo-num-badge:not(.done) {
    background: white !important;
    color: var(--accent) !important;
}

[data-theme="dark"] .todo-check {
    border-color: rgba(255, 255, 255, 0.2);
}

/* ==========================================
   Clip Card
   ========================================== */
.clip-widget {
    width: 220px;
    min-width: 180px;
    padding: 0 0 10px;
}

/* Active clip card — keyboard shortcut target indicator */
.clip-widget.clip-active {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.clip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 14px 8px;
}

.clip-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clip-icon {
    font-size: 13px;
    margin-right: 6px;
    opacity: 0.8;
}

.clip-count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    flex-shrink: 0;
}

.clip-list {
    list-style: none;
    padding: 0 10px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 360px;
    overflow-y: auto;
}

.clip-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: background var(--transition-fast), transform 0.1s ease;
    border: 1px solid transparent;
    position: relative;
}

.clip-item:hover {
    background: var(--accent);
    border-color: transparent;
}

.clip-item:hover .clip-item-text {
    color: white;
}

.clip-item:hover .clip-copy-hint {
    opacity: 1;
}

.clip-item:active {
    transform: scale(0.97);
}

.clip-item-text {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.4;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color var(--transition-fast);
}

.clip-copy-hint {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0;
    flex-shrink: 0;
    transition: opacity var(--transition-fast);
}

/* Label badge */
.clip-item-label {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border-radius: 5px;
    padding: 2px 7px;
    flex-shrink: 0;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.7;
    transition: background var(--transition-fast);
}

.clip-item:hover .clip-item-label {
    color: white;
    background: rgba(255, 255, 255, 0.25);
}

/* Copied flash effect */
.clip-item.copied {
    background: rgba(49, 130, 246, 0.15);
    border-color: var(--accent);
}

.clip-item.copied .clip-item-text {
    color: var(--accent);
}

/* Example tag buttons in modal */
.clip-example-tag {
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 11px;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clip-example-tag:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

[data-theme="dark"] .clip-item {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .clip-item:hover {
    background: var(--accent);
}

/* ==========================================
   Clip Shortcut Hint Box
   ========================================== */
.clip-shortcut-box {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.clip-shortcut-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
    opacity: 0.6;
}

.clip-shortcut-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clip-shortcut-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.clip-shortcut-keys {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
    min-width: 116px;
}

.clip-shortcut-row kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 12px;
    font-family: 'SF Mono', 'Consolas', monospace;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
}

.clip-shortcut-sep {
    font-size: 11px;
    color: var(--text-secondary);
    padding: 0 1px;
}

.clip-shortcut-desc {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}
/* ==========================================
   Inbox (Received Sheets)
   ========================================== */

.inbox-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    background: #F04452;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
    line-height: 1;
}

.inbox-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 92vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -8px 0 32px rgba(0,0,0,0.25);
    z-index: 2100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.inbox-panel.active { transform: translateX(0); }

.inbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 2090;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
}

.inbox-panel.active ~ .inbox-overlay { opacity: 1; pointer-events: auto; }

.inbox-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    flex-shrink: 0;
}

.inbox-panel-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.inbox-panel-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.inbox-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inbox-empty { text-align: center; color: var(--text-tertiary); font-size: 14px; margin-top: 40px; }

.inbox-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inbox-item--new { border-color: var(--accent); }

.inbox-item-header { display: flex; align-items: center; gap: 10px; position: relative; }

.inbox-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.inbox-avatar--placeholder {
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inbox-item-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.inbox-from { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-time { font-size: 11px; color: var(--text-tertiary); }

.inbox-new-dot { position: absolute; top: 0; right: 0; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }

.inbox-sheet-name { font-size: 13px; color: var(--text-secondary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.inbox-actions { display: flex; gap: 8px; }

.inbox-btn {
    flex: 1;
    height: 34px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.15s;
}

.inbox-btn--accept { background: var(--accent); color: #fff; }
.inbox-btn--accept:hover { opacity: 0.88; }
.inbox-btn--delete { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.inbox-btn--delete:hover { background: rgba(240,68,82,0.12); color: #F04452; }
.inbox-accepted-label { flex: 1; height: 34px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #4ade80; background: rgba(74,222,128,0.1); border-radius: var(--radius-sm); }

/* Todo item badge gap */
.todo-item { gap: 8px; }

/* Onboarding Hint Banner */
.onboarding-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 10px 16px;
  background: rgba(30, 34, 44, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 100px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  animation: onboardingHintIn 0.4s cubic-bezier(0.16,1,0.3,1) both;
  white-space: nowrap;
}
.onboarding-hint-text { font-size: 13px; color: rgba(255,255,255,0.82); }
.onboarding-hint-text strong { color: #3182F6; font-weight: 600; }
.onboarding-hint-close {
  background: none; border: none; color: rgba(255,255,255,0.4);
  cursor: pointer; font-size: 14px; padding: 0; flex-shrink: 0;
  transition: color 0.15s;
}
.onboarding-hint-close:hover { color: rgba(255,255,255,0.8); }
@keyframes onboardingHintIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}


/* ==========================================
   Card Color Swatch Popup
   ========================================== */
.card-color-popup {
    position: fixed;
    z-index: 9999;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    box-shadow: var(--shadow-float);
    display: flex;
    gap: 8px;
    align-items: center;
    animation: ctxFadeIn 0.12s ease;
}
.card-color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.card-color-dot:hover { transform: scale(1.2); border-color: rgba(255,255,255,0.4); }
.card-color-dot.active { border-color: #fff; transform: scale(1.15); }
.card-color-dot[data-color="none"] {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
}

/* ==========================================
   Tag Chips on Cards
   ========================================== */
.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 10px 8px;
}
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-light);
    color: var(--accent);
    cursor: default;
    transition: background 0.15s;
    line-height: 1.4;
}
.tag-chip .tag-remove {
    cursor: pointer;
    opacity: 0.5;
    font-size: 10px;
    line-height: 1;
    margin-left: 1px;
}
.tag-chip .tag-remove:hover { opacity: 1; }

/* Tag editor popup */
.tag-editor-popup {
    position: fixed;
    z-index: 9999;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    box-shadow: var(--shadow-float);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    animation: ctxFadeIn 0.12s ease;
}
.tag-editor-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    padding: 5px 10px;
    outline: none;
    width: 100%;
}
.tag-editor-input:focus { border-color: var(--accent); }
.tag-editor-hint { font-size: 11px; color: var(--text-tertiary); }

/* Tag Filter Button in Sheet Bar */
.tag-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.tag-filter-btn:hover { background: var(--accent-light); color: var(--accent); }
.tag-filter-btn.active { background: var(--accent-light); color: var(--accent); }
.tag-filter-dropdown {
    position: fixed;
    z-index: 9999;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    padding: 6px;
    min-width: 160px;
    animation: ctxFadeIn 0.12s ease;
}
.tag-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.12s;
}
.tag-filter-option:hover { background: var(--bg-tertiary); }
.tag-filter-option.active { color: var(--accent); font-weight: 600; }

/* ==========================================
   Message Modal
   ========================================== */
#sendMsgModal .modal-content {
    max-width: 420px;
}
.msg-to-input, .msg-body-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    padding: 9px 12px;
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--transition-fast);
}
.msg-to-input:focus, .msg-body-input:focus { border-color: var(--accent); }
.msg-body-input {
    resize: none;
    height: 110px;
    line-height: 1.6;
}
.msg-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

/* Message Contact Chips */
.msg-contact-chip { display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:20px;background:var(--bg-tertiary);border:1px solid var(--border-color);cursor:pointer;font-size:12px;color:var(--text-secondary);transition:all 0.15s; }
.msg-contact-chip:hover { background:var(--accent-light);color:var(--accent);border-color:var(--accent); }
.msg-contact-chip.selected { background:var(--accent-light);color:var(--accent);border-color:var(--accent); }
.msg-contact-avatar { width:18px;height:18px;border-radius:50%;background:var(--accent);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;flex-shrink:0; }
.msg-contact-label { max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }

/* ==========================================
   Friends Panel
   ========================================== */
.friends-panel {
    position: fixed;
    top: 0; right: -360px;
    width: 320px;
    height: 100%;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(.4,0,.2,1);
}
.friends-panel.active { right: 0; }
.friends-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.friends-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.friends-panel-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    transition: color 0.15s;
}
.friends-panel-close:hover { color: var(--text-primary); }
.friends-add-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.friends-add-row {
    display: flex;
    gap: 6px;
}
.friends-add-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 13px;
    padding: 6px 10px;
    outline: none;
    min-width: 0;
    transition: border-color var(--transition-fast);
}
.friends-add-input:focus { border-color: var(--accent); }
.friends-add-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.friends-add-btn:hover { opacity: 0.85; }
.friends-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.friends-empty {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    padding: 32px 16px;
}
.friend-item {
    padding: 11px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    cursor: default;
    transition: background 0.12s;
}
.friend-item:last-child { border-bottom: none; }
.friend-item:hover { background: var(--bg-tertiary); }
.friend-info { flex: 1; min-width: 0; }
.friend-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.friend-email {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.friend-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    margin-top: 4px;
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-radius: 10px;
    padding: 1px 9px;
    letter-spacing: 0.02em;
}
.friend-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.friend-action-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.12s;
    white-space: nowrap;
    line-height: 1;
}
.friend-action-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.friend-action-btn.danger { color: #fff; background: rgba(239,68,68,0.75); border-color: #ef4444; }
.friend-action-btn.danger:hover { background: #ef4444; color: #fff; border-color: #ef4444; }
.friend-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    margin-top: 4px;
    background: var(--accent-light);
    border: 1.5px solid var(--accent);
    border-radius: 10px;
    padding: 1px 9px;
}
.friend-edit-link {
    font-size: 11px;
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
    flex-shrink: 0;
    opacity: 0.85;
    user-select: none;
}
.friend-edit-link:hover { opacity: 1; text-decoration: underline; }

.friend-edit-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    align-items: center;
}
.friend-edit-input {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    padding: 4px 10px;
    outline: none;
}



/* Message Modal Friend Rows */
.msg-friend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}
.msg-friend-row:hover { background: var(--bg-tertiary); }
.msg-friend-row.selected { background: var(--accent-light); }
.msg-friend-row.selected .msg-friend-check { opacity: 1; color: var(--accent); }
.msg-friend-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.msg-friend-row.selected .msg-friend-avatar { background: var(--accent); }
.msg-friend-info { flex: 1; min-width: 0; }
.msg-friend-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.msg-friend-email { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-friend-check { font-size: 16px; opacity: 0; transition: opacity 0.15s; color: var(--accent); flex-shrink: 0; }

/*  Text / Whiteboard Widget  */
.text-widget {
    min-width: 220px; min-height: 80px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0; display: flex; flex-direction: column;
    overflow: visible; position: absolute; cursor: default;
}
.text-widget-toolbar {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary, var(--bg-secondary));
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-shrink: 0; cursor: grab;
}
.tw-btn {
    background: none; border: 1px solid var(--border-color);
    border-radius: 6px; color: var(--text-primary);
    font-size: 16px; font-weight: 600; padding: 6px 12px;
    cursor: pointer; transition: background 0.15s, color 0.15s;
    flex-shrink: 0; line-height: 1.2;
}
.tw-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tw-size { font-size: 14px; color: var(--text-tertiary); min-width: 44px; text-align: center; flex-shrink: 0; font-weight: 500; }
.text-widget-body {
    flex: 1; padding: 10px 14px; outline: none; font-family: inherit;
    line-height: 1.35; word-break: break-word; white-space: pre-wrap;
    overflow-y: auto; cursor: text; min-height: 60px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.text-widget-body:empty::before { content: attr(data-placeholder); color: var(--text-tertiary); pointer-events: none; opacity: 0.5; }
.text-widget:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(49,130,246,0.12); }
.text-widget-resize {
    position: absolute; right: 0; bottom: 0; width: 16px; height: 16px;
    cursor: se-resize; background: linear-gradient(135deg, transparent 50%, var(--border-color) 50%);
    border-radius: 0 0 var(--radius-md) 0; z-index: 2; opacity: 0.6; transition: opacity 0.15s;
}
.text-widget-resize:hover { opacity: 1; }
