@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

#modal-backdrop,
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    z-index: 10000;
    overflow: auto;
    padding: 24px 12px;
    box-sizing: border-box;
}

.modal-overlay .modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.1);
    animation: modal-pop 0.2s ease;
}

.modal-overlay .modal-content h3 {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 600;
    color: #16202a;
}

.modal-overlay label {
    display: block;
    margin: 12px 0 6px;
    font-weight: 600;
    font-size: 13px;
    color: #334155;
}

.modal-overlay input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d5dbe2;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.modal-overlay input:focus {
    outline: none;
    border-color: #34C780;
    box-shadow: 0 0 0 3px rgba(52, 199, 128, 0.15);
}

.modal-overlay .modal-actions {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.modal-overlay .modal-actions .settings-button {
    flex: 1 1 0;
    min-width: 70px;
    padding: 8px 12px;
    font-size: 13px;
}

.modal-overlay .settings-button {
    margin-top: 0;
    background: #e8ebef !important;
    color: #3a4049 !important;
    border: 1px solid #d1d5db !important;
}

.modal-overlay .settings-button.primary {
    background: #34C780 !important;
    color: #fff !important;
    border: none !important;
}

.modal-overlay .settings-button.error {
    background: #e53e3e !important;
    color: #fff !important;
    border: none !important;
}

.modal-overlay .settings-button:hover {
    filter: brightness(0.95);
}

.modal-overlay .settings-button:active {
    transform: translateY(1px);
}

.modal-overlay ::-webkit-scrollbar {
    width: 8px;
}

.modal-overlay ::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 10px;
}

.theme-dark .modal-overlay {
    background: rgba(15, 23, 42, 0.55);
}

.theme-dark .modal-overlay .modal-content {
    background: #1f2933;
    color: #e5e9f0;
    box-shadow: 0 20px 40px rgba(5, 10, 20, 0.5), 0 0 0 1px rgba(46, 60, 78, 0.4);
}

.theme-dark .modal-overlay .modal-content h3,
.theme-dark .modal-overlay label {
    color: #f1f5f9;
}

.theme-dark .modal-overlay input {
    background: #27323f;
    border-color: #364152;
    color: #e5e9f0;
}

.theme-dark .modal-overlay input:focus {
    border-color: #34C780;
    box-shadow: 0 0 0 3px rgba(52, 199, 128, 0.2);
}

.theme-dark .modal-overlay .settings-button {
    background: #3a4049 !important;
    color: #e5e9f0 !important;
    border: 1px solid #4a525c !important;
}

.theme-dark .modal-overlay .settings-button.primary {
    background: #34C780 !important;
    color: #fff !important;
    border: none !important;
}

.theme-dark .modal-overlay .settings-button.error {
    background: #e53e3e !important;
    color: #fff !important;
    border: none !important;
}

@keyframes modal-pop {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
#top-notification {
    /* Lives between search and header buttons */
    position: static;
    margin-left: auto;
    margin-right: 8px;
    max-width: 40vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;

    display:none;
}
#top-notification.info { background: rgba(59,130,246,0.15); color: #b3d1ff; }
#top-notification.success { background: rgba(16,185,129,0.18); color: #b9f2d9; }
#top-notification.warning { background: rgba(245,158,11,0.18); color: #ffe0b3; }
#top-notification.error { background: rgba(239,68,68,0.2); color: #ffc9c9; }

@keyframes notify-pulse {
  0% { box-shadow: 0 0 0 0 rgba(59,130,246,0.35); }
  70% { box-shadow: 0 0 0 8px rgba(59,130,246,0); }
  100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); }
}
#top-notification.ping { animation: notify-pulse 0.9s ease-out 1; }
/* Removed Google Fonts for instant loading - using system fonts */

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
    background: #fff;
    color: #222;
    margin: 0;
    overflow-x: hidden;
}

.theme-dark {
    background: #181c1f;
    color: #e0e0e0;
}

.theme-dark #global-header,
.theme-dark #main-nav,
.theme-dark #main-content,
.theme-dark #boards-container,
.theme-dark .vstat-board,
.theme-dark .settings-panel,
.theme-dark .notification,
.theme-dark .vstat-column,
.theme-dark .vstat-group,
.theme-dark .vstat-group-header,
.theme-dark .column-drag-handle,
.theme-dark .vstat-link,
.theme-dark #search,
.theme-dark #add-item-modal,
.theme-dark #edit-modal,
.theme-dark #edit-item-modal,
.theme-dark .header-btn,
.theme-dark .settings-button {
    background: #23272a !important;
    color: #e0e0e0 !important;
    border-color: #31363b !important;
}

.theme-dark .vstat-board { background: transparent !important; }
.theme-dark .vstat-group { background-color: #23272a !important; }
.theme-dark .vstat-group:hover { background-color: #2c3136 !important; }

.theme-dark .vstat-group:hover {
    background-color: #333;
    box-shadow: 0 2px 12px rgba(52, 199, 128, 0.2);
}

.theme-dark .vstat-group-title,
.theme-dark .vstat-column-title,
.theme-dark #add-item-modal h3,
.theme-dark #edit-modal h3,
.theme-dark #edit-item-modal h3,
.theme-dark #add-item-modal label,
.theme-dark #edit-modal label,
.theme-dark #edit-item-modal label {
    color: #e0e0e0;
}

.theme-dark .group-drag-handle,
.theme-dark .drag-handle {
    color: #666;
}

.theme-dark .group-drag-handle:hover {
    background-color: #333;
}

.theme-dark .vstat-link a,
.theme-dark .vstat-link a:hover,
.theme-dark .search-button,
.theme-dark .nav-section-item.nav-item-selected,
.theme-dark .edit-item-btn:hover,
.theme-dark .edit-board-btn:hover,
.theme-dark .delete-board-btn:hover {
    color: #34C780;
}

.theme-dark .vstat-link:hover,
.theme-dark .vstat-link.active {
    background: #2a2e33;
}

.theme-dark .header-btn.primary,
.theme-dark .settings-button.primary {
    background: #34C780 !important;
    color: #fff !important;
}

.theme-dark .notification.success { border-left: 4px solid #34C780; }
.theme-dark .notification.error { border-left: 4px solid #E13C50; }
.theme-dark .notification.info { border-left: 4px solid #43CCF8; }

.theme-dark .nav-section-title {
    color: #b0b0b0;
}

.theme-dark .nav-item-count {
    background: #34C780;
    color: #fff;
}

.theme-dark #add-item-modal input,
.theme-dark #edit-modal input,
.theme-dark #edit-item-modal input {
    background: #2c3136;
    color: #e0e0e0;
    border-color: #31363b;
}

.theme-dark .board-nav-item:hover {
    background: #2c3136;
}

.theme-dark .board-nav-item.selected {
    background: #23272a;
    color: #34C780;
}

.theme-dark .create-new-board {
    background: #34C780;
    color: #fff;
}

.theme-dark .edit-board-btn,
.theme-dark .delete-board-btn {
    color: #e0e0e0;
}

/* Ensure search icon in dark theme is not white */
.theme-dark .search-button {
    color: #34C780 !important;
    background: transparent !important;
    border-color: #31363b !important;
}

#main-content {
    margin-left: 48px !important;
    padding: 40px 5px 0 5px;
    min-height: calc(100vh - 44px);
    box-sizing: border-box;
    transition: margin-left 0.3s;
    overflow-x: auto;
}

#main-content.expanded {
    margin-left: 180px !important;
}

/* Removed unused move modal styles - modals no longer exist */

.vstat-board {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 12px;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    background: #fff;
    padding: 0 12px;
    margin-top: 8px;
    overflow-x: auto;
    position: relative;
    min-width: max-content;
}

.vstat-group {
    margin-bottom: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    background-color: #f8f9fa;
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
    border: none;
    overflow: hidden;
    box-sizing: border-box;
    max-width: 100%;
    min-height: 60px;
    pointer-events: auto;
}

/* Highlight category on drag-over with outline and background */
.vstat-group.drag-over {
    background-color: #e6f0fa;
    outline: 2px solid #007bff;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.7);
    z-index: 2;
}

/* Remove .drag-over-top/bottom for groups to simplify */
.vstat-group.drag-over-top,
.vstat-group.drag-over-bottom {
    background-color: #e6f0fa;
    outline: 2px solid #007bff;
    box-shadow: 0 0 8px rgba(0, 123, 255, 0.7);
    z-index: 2;
}

/* Ensure child elements don't block drag events */
.vstat-link-list,
.vstat-link {
    pointer-events: none;
}

.vstat-link-title,
.vstat-link-title {
    pointer-events: auto;
}

/* Ensure group controls are clickable */
.group-controls,
.group-controls * {
    pointer-events: auto;
}

.vstat-link.drag-over-top::before,
.vstat-link.drag-over-bottom::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #007bff;
    z-index: 3;
}
.vstat-link.drag-over-top::before {
    top: -2px;
}
.vstat-link.drag-over-bottom::before {
    bottom: -2px;
}

.vstat-column {
    padding: 5px;
    background: transparent;
    margin: 0; /* remove extra side margins; rely on flex gap for spacing so N columns fit exactly */
    position: relative;
    display: flex;
    flex-direction: column;
    height: auto;
    overflow-y: visible;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, border 0.2s;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-width: 200px;
    box-sizing: border-box;
}

.vstat-column.empty {
    background-color: transparent;
    border: none;
    border-radius: 0;
    justify-content: center;
    align-items: center;
    color: transparent;
    font-style: normal;
    flex: 1 1 auto;
    padding: 6px;
    margin: 0; /* align with regular columns */
}

.vstat-column.empty::before {
    content: '';
    text-align: center;
    padding: 20px;
}

.vstat-column.dummy {
    visibility: hidden;
    pointer-events: none;
    flex: 1 1 auto;
    padding: 6px;
    margin: 0; /* align with regular columns */
}

/* Right fixed column inside the board */
.vstat-column.right-fixed {
    /* Flexible width: minimum 260px, can grow with content */
    flex: 0 1 320px;
    min-width: 260px;
    max-width: none;
}
.vstat-column.right-fixed .column-drag-handle { display: none; }

.vstat-right-block {
    position: fixed;
    top: 44px;
    right: 0;
    width: 238px;
    height: calc(100vh - 44px);
    background: #f8f9fa;
    padding: 12px;
    box-sizing: border-box;
    z-index: 100;
    border-left: 1px solid #ccd1d4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.vstat-right-block::before {
    content: '';
    color: transparent;
    font-style: normal;
    text-align: center;
    padding: 20px;
}

.vstat-right-block .vstat-group {
    width: 100%;
    max-height: 100%;
    overflow-y: auto;
}

.vstat-right-block h3 {
    font-size: 16px;
    color: #424b4f;
    margin: 0 0 10px;
}

.vstat-right-block .vstat-link {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Grid mode: when board uses CSS Grid, allow columns to shrink so all tracks fit */
.vstat-board.grid-mode .vstat-column,
.vstat-board.grid-mode .vstat-column.empty,
.vstat-board.grid-mode .vstat-column.dummy {
    min-width: 0 !important;
    width: auto !important;
}

/* Grid mode container: enforce grid with 20px column gaps and no horizontal overflow */
.vstat-board.grid-mode {
    display: grid !important;
    grid-template-columns: repeat(var(--vstat-col-count, 5), minmax(0, 1fr)) !important;
    gap: 0px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 8px 0 0 0;
    overflow-x: hidden !important;
}

/* Link row visuals */
.vstat-link {
    list-style: none;
}
.vstat-link > a {
    display: block;
    text-decoration: none;
}
.vstat-link-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dark theme safe colors for links */
body.theme-dark .vstat-link > a {
    color: #b9e5c4; /* keep readable green tone */
}
body.theme-dark .vstat-link > a:hover {
    color: #d1f2da;
}

/* Column widths for ≥800px */
@media screen and (min-width: 800px) {
    .vstat-board.board-columns-1 .vstat-column,
    .vstat-board.board-columns-1 .vstat-column.empty,
    .vstat-board.board-columns-1 .vstat-column.dummy {
        width: calc((100% - 12px) / 1);
        min-width: 300px;
    }
    .vstat-board.board-columns-2 .vstat-column,
    .vstat-board.board-columns-2 .vstat-column.empty,
    .vstat-board.board-columns-2 .vstat-column.dummy {
        width: calc((100% - 12px) / 2);
        min-width: 280px;
    }
    .vstat-board.board-columns-3 .vstat-column,
    .vstat-board.board-columns-3 .vstat-column.empty,
    .vstat-board.board-columns-3 .vstat-column.dummy {
        width: calc((100% - 24px) / 3);
        min-width: 260px;
    }
    .vstat-board.board-columns-4 .vstat-column,
    .vstat-board.board-columns-4 .vstat-column.empty,
    .vstat-board.board-columns-4 .vstat-column.dummy {
        width: calc((100% - 36px) / 4);
        min-width: 240px;
    }
    .vstat-board.board-columns-5 .vstat-column,
    .vstat-board.board-columns-5 .vstat-column.empty,
    .vstat-board.board-columns-5 .vstat-column.dummy {
        width: calc((100% - 48px) / 5);
        min-width: 220px;
    }
    .vstat-board.board-columns-6 .vstat-column,
    .vstat-board.board-columns-6 .vstat-column.empty,
    .vstat-board.board-columns-6 .vstat-column.dummy {
        width: calc((100% - 60px) / 6);
        min-width: 200px;
    }
    .vstat-board.board-columns-7 .vstat-column,
    .vstat-board.board-columns-7 .vstat-column.empty,
    .vstat-board.board-columns-7 .vstat-column.dummy {
        width: calc((100% - 72px) / 7);
        min-width: 180px;
    }
}

/* Responsive wrapping for <800px */
@media screen and (max-width: 799px) {
    .vstat-board {
        flex-wrap: wrap;
        max-width: 100%;
        margin-top: 46px !important;
    }
    .vstat-board .vstat-column,
    .vstat-board .vstat-column.empty,
    .vstat-board .vstat-column.dummy {
        width: 100%;
        min-width: 300px;
    }
    .vstat-right-block {
        display: none;
    }
}

.vstat-column.empty::before {
    content: '';
    text-align: center;
    padding: 20px;
}

.vstat-column.dragging {
    opacity: 0.7;
    transform: rotate(2deg) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    cursor: grabbing;
}

.vstat-column.drag-over {
    background-color: rgba(52, 199, 128, 0.1) !important;
    border: 2px dashed #34C780 !important;
    height: 100%;
    min-height: 150px;
}

.column-drag-handle {
    cursor: grab;
    padding: 4px 6px;
    opacity: 0.3;
    transition: opacity 0.2s;
    font-size: 16px;
    color: #555;
    text-align: center;
    margin: 0 0 8px 0;
    background-color: #f5f5f5;
    border-radius: 3px;
}

.vstat-column:hover .column-drag-handle {
    opacity: 0.8;
}

.vstat-group {
    margin-bottom: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    background-color: #f8f9fa;
    cursor: grab;
    transition: all 0.2s ease;
    position: relative;
    border: none;
    overflow-y: visible;
}

.vstat-group.dragging {
    opacity: 0.7;
    transform: rotate(1deg) scale(1.02);
    cursor: grabbing;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.vstat-group:hover {
    background-color: #fff;
    box-shadow: 0 2px 12px rgba(52, 199, 128, 0.15);
    transform: translateY(-1px);
}

.vstat-group.drag-over:not(.unavailable) {
    background-color: rgba(52, 199, 128, 0.1) !important;
    outline: 2px dashed #34C780 !important;
}
.vstat-group.drag-over.unavailable{
    background-color: #ec8b8b !important;
    outline: 2px dashed #F53939FF !important;
}

.vstat-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 4px 0;
    padding: 4px;
    background: transparent;
    position: relative;
    min-height: 20px;
    cursor: pointer;
}

.vstat-group-title {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: #333;
    letter-spacing: 0.2px;
    padding-left: 6px;
    border-left: 2px solid #34C780;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-drag-handle, .url-drag-handle {
    cursor: grab;
    color: #999;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 2px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.group-drag-handle:hover {
    opacity: 1;
    background-color: #f0f0f0;
}

.vstat-group:active .group-drag-handle {
    cursor: grabbing;
}

.vstat-link-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.vstat-link {
    display: flex;
    align-items: center;
    padding: 3px 4px;
    margin: 0 0 1px 0;
    border-radius: 4px;
    transition: all 0.15s ease;
    position: relative;
}

.vstat-link.dragging {
    opacity: 0.7;
    transform: rotate(1deg) scale(1.02);
    cursor: grabbing;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.vstat-link.drag-over {
    background-color: rgba(52, 199, 128, 0.1) !important;
    border: 2px dashed #34C780 !important;
}

.vstat-link a {
    color: #444;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif;
}

.vstat-link a:hover {
    color: #34C780;
    text-decoration: underline;
}

.vstat-link-title {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
}

.vstat-link-undetitle{
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vstat-link-text-single {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.vstat-link-title--suggested {
    align-items: flex-start;
    gap: 4px;
}

.vstat-link-title--suggested .vstat-link-lines {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    line-height: 1.2;
}

.vstat-link-title--suggested .vstat-link-text {
    font-weight: 600;
    font-size: 13px;
    color: inherit;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.vstat-link-title--suggested .vstat-link-description {
    font-size: 11px;
    color: #6b7280;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.25;
}

.theme-dark .vstat-link-title--suggested .vstat-link-description {
    color: #94a3b8;
}

.vstat-link-favicon{
    margin-right: 2px;
}

/* Prevent favicon flicker during load */
.vstat-link-favicon.favicon-loading {
    opacity: 0;
}

.vstat-link-favicon.favicon-loaded {
    opacity: 1;
    transition: opacity 0.15s ease-in;
}

.theme-dark .vstat-link-description,
.theme-dark .vstat-link-undetitle {
    color: #94a3b8;
}
.edit-item-btn.visible{
    display: block;
}
.edit-item-btn {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
}

.vstat-link:hover .edit-item-btn {
    display: block;
}

.edit-item-btn:hover {
    color: #34C780;
}

.group-controls {
    display: none;
    position: absolute;
    right: 0px;
    top: 50%;
    transform: translateY(-50%);
    gap: 2px;
    align-items: center;
    z-index: 10;
}

.vstat-group-header:hover .group-controls {
    display: flex !important;
}

/* Top notification in header */
#top-notification {
    flex: 1;
    margin: 0 10px;
    font-size: 14px;
    line-height: 20px;
    height: 20px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #333;
}
#top-notification.info { color: #3b82f6; }
#top-notification.success { color: #16a34a; }
#top-notification.warning { color: #d97706; }
#top-notification.error { color: #dc2626; }

body.theme-dark #top-notification { color: #e5e7eb; }
body.theme-dark #top-notification.info { background: rgba(59,130,246,0.18); color: #93c5fd; }
body.theme-dark #top-notification.success { background: rgba(16,185,129,0.22); color: #86efac; }
body.theme-dark #top-notification.warning { background: rgba(245,158,11,0.22); color: #fcd34d; }
body.theme-dark #top-notification.error { background: rgba(239,68,68,0.24); color: #fca5a5; }

/* During column dragging, let columns capture events by disabling children pointer events */
body.column-dragging .vstat-group,
body.column-dragging .vstat-group * {
    pointer-events: none !important;
}

/* Dark theme scrollbar (horizontal bottom bar should not be white) */
body.theme-dark {
    scrollbar-color: #3a3f44 #1e2226; /* Firefox */
}
body.theme-dark ::-webkit-scrollbar {
    height: 10px;
    background: #1e2226;
}
body.theme-dark ::-webkit-scrollbar-thumb {
    background: #3a3f44;
    border-radius: 6px;
    border: 1px solid #2a2f34;
}
body.theme-dark ::-webkit-scrollbar-thumb:hover {
    background: #4a5056;
}
body.theme-dark ::-webkit-scrollbar-track {
    background: #1e2226;
}

/* Ensure horizontal bottom scrollbars of content areas are dark too */
.theme-dark #main-content::-webkit-scrollbar,
html.theme-dark #main-content::-webkit-scrollbar,
.theme-dark .vstat-board::-webkit-scrollbar,
html.theme-dark .vstat-board::-webkit-scrollbar {
    height: 10px;
    background: #1e2226;
}
.theme-dark #main-content::-webkit-scrollbar-thumb,
html.theme-dark #main-content::-webkit-scrollbar-thumb,
.theme-dark .vstat-board::-webkit-scrollbar-thumb,
html.theme-dark .vstat-board::-webkit-scrollbar-thumb {
    background: #3a3f44;
    border-radius: 6px;
    border: 1px solid #2a2f34;
}
.theme-dark #main-content::-webkit-scrollbar-track,
html.theme-dark #main-content::-webkit-scrollbar-track,
.theme-dark .vstat-board::-webkit-scrollbar-track,
html.theme-dark .vstat-board::-webkit-scrollbar-track {
    background: #1e2226;
}

/* Firefox: apply dark scrollbar colors on scrolled containers */
.theme-dark #main-content,
html.theme-dark #main-content,
.theme-dark .vstat-board,
html.theme-dark .vstat-board {
    scrollbar-color: #3a3f44 #1e2226;
}

.board, .category-container, .card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(52,199,128,0.07), 0 1.5px 4px rgba(0,0,0,0.04);
    margin-bottom: 32px;
    padding-bottom: 8px;
}

/* Dark theme overrides for board/card and texts */
body.theme-dark .board, body.theme-dark .category-container, body.theme-dark .card {
    background: #22272b;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2), 0 1.5px 4px rgba(0,0,0,0.15);
    border-color: #2b3136;
}
body.theme-dark .title-description-container {
    background: #22272b;
    border-left-color: #34C780;
}
body.theme-dark .board-title, body.theme-dark .card-title {
    color: #e0e0e0;
}
body.theme-dark .board-description, body.theme-dark .card-description {
    color: #a8b3bd;
}
body.theme-dark .command-btn,
html.theme-dark .command-btn {
    background: #2c3136;
    color: #e0e0e0;
}
body.theme-dark .command-btn:hover,
html.theme-dark .command-btn:hover {
    background: #343b41;
}
body.theme-dark .item-bookmark a {
    color: #e0e0e0;
}
body.theme-dark .item-bookmark:hover a {
    background: #2c3136;
    color: #34C780;
}

/* Show Create category button only in edit mode */
#add-category-btn { display: none; }
html.edit-mode #add-category-btn { display: inline-block; }

.board-header {
    padding: 24px 24px 8px 24px;
    border-bottom: 1px solid #f0f1f2;
}

.board-title {
    font-size: 28px;
    font-weight: 700;
    color: #424b4f;
    margin-bottom: 4px;
}

.board-description {
    color: #a0a0a0;
    font-size: 15px;
}

.board-commands {
    padding: 12px 24px 12px 24px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
}

.command-btn {
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    background: #f0f1f2;
    color: #424b4f;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.command-btn:hover {
    background: #e3e6e8;
}

.commands-right {
    margin-left: auto;
    color: #a0a0a0;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    gap: 18px;
}

.cards-container {
    display: flex;
    gap: 24px;
    padding: 24px 24px 20px 24px;
}

.category-slot {
    flex: 1 1 0;
    min-width: 260px;
    max-width: 340px;
}

.title-description-container {
    padding: 18px 20px 10px 18px;
    border-left: 5px solid #34C780;
    border-radius: 10px 10px 0 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    min-height: 60px;
}

/* Dark theme: make category header (title bar) dark and neutral */
.theme-dark .title-description-container,
html.theme-dark .title-description-container {
    background: #23272a !important;
    border-left-color: #3a3f44 !important;
}

/* Override per-slot colored borders in dark theme to keep it subtle */
.theme-dark .category-slot .title-description-container,
html.theme-dark .category-slot .title-description-container {
    border-left-color: #3a3f44 !important;
}

.category-slot:nth-child(2) .title-description-container { border-left-color: #43CCF8; }
.category-slot:nth-child(3) .title-description-container { border-left-color: #F5A623; }

/* Ensure nth-child color accents are muted in dark theme */
.theme-dark .category-slot:nth-child(1) .title-description-container,
.theme-dark .category-slot:nth-child(2) .title-description-container,
.theme-dark .category-slot:nth-child(3) .title-description-container,
html.theme-dark .category-slot:nth-child(1) .title-description-container,
html.theme-dark .category-slot:nth-child(2) .title-description-container,
html.theme-dark .category-slot:nth-child(3) .title-description-container {
    border-left-color: #3a3f44 !important;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: #424b4f;
    margin-bottom: 2px;
}

.card-description {
    color: #a0a0a0;
    font-size: 13px;
    font-weight: 500;
}

.add-item-controls {
    position: absolute;
    right: 18px;
    top: 18px;
    display: none;
}

.card:hover .add-item-controls {
    display: block;
}

.item-container {
    padding: 0 18px 18px 18px;
}

.item-bookmark {
    position: relative;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.item-bookmark a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px 7px 0;
    color: #424b4f;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    border-radius: 6px;
    flex: 1;
    transition: background 0.2s, color 0.2s;
}

.item-bookmark:hover a {
    background: #f0f1f2;
    color: #34C780;
}

.item-icon {
    font-size: 22px;
    width: 28px;
    text-align: center;
}

.edit-controls {
    position: absolute;
    right: 6px;
    top: 7px;
    display: none;
}

.item-bookmark:hover .edit-controls {
    display: flex;
    gap: 4px;
}

.group-controls .add-icon,
.group-controls .edit-icon,
.group-controls .delete-icon {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.3s ease;
    border: none;
    color: white;
    position: relative;
    overflow: hidden;
}

.group-controls .add-icon::before,
.group-controls .edit-icon::before,
.group-controls .delete-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.group-controls .add-icon:hover,
.group-controls .edit-icon:hover,
.group-controls .delete-icon:hover {
    opacity: 1;
    transform: translateY(-1px);
}

.group-controls .add-icon:hover::before,
.group-controls .edit-icon:hover::before,
.group-controls .delete-icon:hover::before {
    left: 100%;
}

.group-controls .add-icon:active,
.group-controls .edit-icon:active,
.group-controls .delete-icon:active {
    transform: translateY(0);
}

/* Base (neutral) for add button; light theme will opt-in to green */
.group-controls .add-icon {
    background: #2b3136;
    color: #cfd3d7;
    border: 1px solid #2f353a;
    box-shadow: none;
    background-image: none;
    text-shadow: none;
}

.group-controls .add-icon:hover {
    background: #30363c;
    color: #d6dadd;
    border-color: #343b41;
}

.group-controls .add-icon:active {
    background: #2a2f34;
    border-color: #2f353a;
}

/* Light theme: opt-in bright green for add button */
.theme-light .group-controls .add-icon,
html.theme-light .group-controls .add-icon
{
    background: linear-gradient(135deg, #34C780 0%, #2fb373 100%);
    color: #fff;
    border: none;
    box-shadow: 0 1px 4px rgba(52, 199, 128, 0.3);
}
.theme-light .group-controls .add-icon:hover,
html.theme-light .group-controls .add-icon:hover
{
    box-shadow: 0 2px 8px rgba(52, 199, 128, 0.4);
}
.theme-light .group-controls .add-icon:active,
html.theme-light .group-controls .add-icon:active
{
    box-shadow: 0 1px 3px rgba(52, 199, 128, 0.3);
}

.group-controls .edit-icon {
    background: linear-gradient(135deg, #43CCF8 0%, #3bb8e6 100%);
    box-shadow: 0 1px 4px rgba(67, 204, 248, 0.3);
}

.group-controls .edit-icon:hover {
    box-shadow: 0 2px 8px rgba(67, 204, 248, 0.4);
}

.group-controls .edit-icon:active {
    box-shadow: 0 1px 3px rgba(67, 204, 248, 0.3);
}

.group-controls .delete-icon {
    background: linear-gradient(135deg, #E13C50 0%, #c93045 100%);
    box-shadow: 0 1px 4px rgba(225, 60, 80, 0.3);
}

.group-controls .delete-icon:hover {
    box-shadow: 0 2px 8px rgba(225, 60, 80, 0.4);
}

.group-controls .delete-icon:active {
    box-shadow: 0 1px 3px rgba(225, 60, 80, 0.3);
}

.item-select-box {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    border: 1.5px solid #ccd1d4;
    border-radius: 3px;
    background: #fff;
    display: inline-block;
    vertical-align: middle;
}

.item-bookmark.selected .item-select-box {
    background: #34C780;
    border-color: #2fb373;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #a0a0a0;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #424b4f;
}

.empty-state p {
    margin-bottom: 20px;
}

.settings-panel {
    position: fixed;
    right: -320px;
    top: 44px;
    bottom: 0;
    width: 320px;
    background: #fff;
    border-left: 1px solid #ccd1d4;
    transition: right 0.3s ease-in-out;
    z-index: 1100;
    box-shadow: -4px 0 16px rgba(52,199,128,0.07);
}

.settings-panel.visible {
    right: 0;
}

.settings-header {
    padding: 20px;
    border-bottom: 1px solid #ccd1d4;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-title {
    font-size: 20px;
    font-weight: 700;
    color: #424b4f;
}

.close-settings {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: #a0a0a0;
}

.settings-content {
    padding: 20px;
}

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

.settings-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #424b4f;
    margin-bottom: 15px;
}

.settings-button {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: none;
    border-radius: 6px;
    background: #f0f1f2;
    color: #424b4f;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.settings-button:hover {
    background: #e3e6e8;
}

.settings-button.primary {
    background: #34C780;
    color: #fff;
}

.settings-button.primary:hover {
    background: #2fb373;
}

.settings-button.error {
    background: #E13C50;
    color: #fff;
}

.settings-button.error:hover {
    background: #c93045;
}

.group-toggle-visible-btn {
    width: auto !important;
    padding: 2px 0 !important;
    margin: 0 auto !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-align: center !important;
    background: transparent !important;
    color: #999 !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: inline-block !important;
    text-decoration: underline !important;
    text-decoration-style: dashed !important;
    text-underline-offset: 3px !important;
}

.group-toggle-visible-btn:hover {
    color: #34C780 !important;
    text-decoration-color: #34C780 !important;
    background: transparent !important;
    transform: none !important;
    box-shadow: none !important;
}

.group-toggle-visible-btn:active {
    color: #2fb373 !important;
    text-decoration-color: #2fb373 !important;
    transform: none !important;
    box-shadow: none !important;
}

.theme-dark .group-toggle-visible-btn {
    background: transparent !important;
    color: #999 !important;
    text-decoration-color: #666 !important;
}

.theme-dark .group-toggle-visible-btn:hover {
    color: #34C780 !important;
    text-decoration-color: #34C780 !important;
    background: transparent !important;
}

.notification {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 15px 20px;
    background: #fff;
    border: 1px solid #ccd1d4;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    z-index: 1200;
    max-width: 320px;
    font-size: 15px;
}

.notification.success { border-left: 4px solid #34C780; }
.notification.error { border-left: 4px solid #E13C50; }
.notification.info { border-left: 4px solid #43CCF8; }

#global-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    min-height: 44px;
    padding: 0 18px;
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    box-shadow: none;
    z-index: 1001;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
    width: 100%;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-image {
    width: 22px;
    height: 22px;
    margin-right: 2px;
}

.logo-icon {
    width: 22px;
    height: 22px;
    max-width: 22px;
    max-height: 22px;
    object-fit: contain;
    display: block;
}

.logo-icon-small {
    width: 15.4px;
    height: 15.4px;
    max-width: 15.4px;
    max-height: 15.4px;
    object-fit: contain;
    display: block;
}

.logo-text {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: #3b82f6;
    transition: opacity 0.2s ease;
}

.logo-text:hover {
    opacity: 0.8;
}

.beta-label {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 7.5px;
    font-weight: 500;
    color: #333;
    opacity: 0.6;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.search-container {
    display: flex;
    gap: 10px;
}

#search {
    height: 28px;
    font-size: 14px;
    padding: 2px 8px;
    border-radius: 5px;
    border: 1px solid #e5e5e5;
    width: 200px;
}

.search-button {
    font-size: 15px;
    padding: 2px 7px;
    border-radius: 5px;
    border: none;
    background: #f5f6fa;
    cursor: pointer;
}

.header-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-btn {
    font-size: 15px;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid #e5e5e5;
    background: #fff;
    color: #222;
    cursor: pointer;
    height: 28px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-btn.primary {
    background: #34C780;
    color: #fff;
    border: none;
}

#main-nav {
    position: relative;
    float:left;
    top: 44px;
    left: 0;
    bottom: 0;
    width: 48px;
    min-width: 48px;
    background: #fff;
    border-right: 1px solid #e5e5e5;
    padding: 0;
    font-size: 13px;
    transition: width 0.2s;
    z-index: 1000;
    height: calc(100vh - 44px);
    overflow-y: auto;
    overflow-x: hidden;
}

#main-nav.expanded {
    width: 180px;
    min-width: 180px;
}

.nav-section {
    margin: 10px 0 0 0;
    padding: 0 0 0 0;
}

.nav-section.layouts {
    display: flex;
    justify-content: center;
    display: none;
}

.expanded .nav-section.layouts {
    flex-direction: column;
}

.nav-section-title {
    font-size: 11px;
    color: #b0b0b0;
    margin: 8px 0 2px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: opacity 0.2s;
}

#main-nav:not(.expanded) .nav-section-title {
    display: none;
}

.nav-section-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 0 5px 12px;
    font-size: 14px;
    color: #222;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 2px;
    position: relative;
}

#main-nav:not(.expanded) .nav-section-item {
    justify-content: center;
    padding: 8px;
    margin: 4px 6px;
}

#main-nav:not(.expanded) .nav-item-text,
#main-nav:not(.expanded) .nav-item-count {
    display: none;
}

#main-nav:not(.expanded) .nav-section-item:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-left: 8px;
    opacity: 0;
    animation: fadeIn 0.2s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.nav-section-item .nav-item-icon {
    font-size: 16px;
    width: 18px;
    text-align: center;
}

.nav-section-item .nav-item-count {
    background: #34C780;
    color: #fff;
    font-size: 11px;
    border-radius: 8px;
    padding: 0 6px;
    margin-left: auto;
    min-width: 18px;
    text-align: center;
}

.nav-section-item.nav-item-selected {
    background: #f5f6fa;
    color: #34C780;
}

.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    font-size: 18px;
    margin: 8px auto 0px 8px;
    display: block;
    background: none;
    border: none;
    color: #b0b0b0;
    cursor: pointer;
}

#boards-list {
    margin-top: 8px;
    padding: 0 12px;
    display: none;
}

#main-nav.expanded #boards-list {
    display: block;
}

.board-nav-item {
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 4px;
    position: relative;
}

.board-nav-item:hover {
    background: #f0f1f2;
}

.board-nav-item.selected {
    background: #f5f6fa;
    color: #34C780;
}

.edit-board-btn, .delete-board-btn {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.board-nav-item:hover .edit-board-btn, .board-nav-item:hover .delete-board-btn {
    display: inline-block;
}

.edit-board-btn {
    right: 25px;
}

.delete-board-btn {
    right: 5px;
}

.edit-board-btn:hover, .delete-board-btn:hover {
    color: #34C780;
}

/* Upgrade link styling */
.board-nav-item.upgrade-link {
    background: linear-gradient(135deg, #34C780 0%, #2ca36c 100%);
    padding: 10px 12px;
    margin-top: 8px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(52, 199, 128, 0.3);
    transition: all 0.3s ease;
    position: relative;
}

.board-nav-item.upgrade-link:hover {
    background: linear-gradient(135deg, #2ca36c 0%, #34C780 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 199, 128, 0.5);
}

.board-nav-item.upgrade-link a {
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 100%;
    margin: -10px -12px;
    padding: 10px 12px;
}

.board-nav-item.upgrade-link .upgrade-icon {
    font-size: 18px;
    display: inline-block;
}

.board-nav-item.upgrade-link .upgrade-text {
    display: inline-block;
}

/* Collapsed state - show only icon */
#main-nav.collapsed .board-nav-item.upgrade-link {
    padding: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(52, 199, 128, 0.4);
}

#main-nav.collapsed .board-nav-item.upgrade-link a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: -12px;
    padding: 12px;
}

#main-nav.collapsed .board-nav-item.upgrade-link .upgrade-text {
    display: none;
}

#main-nav.collapsed .board-nav-item.upgrade-link .upgrade-icon {
    font-size: 22px;
    /* Animation only on hover to reduce CPU usage */
}

#main-nav.collapsed .board-nav-item.upgrade-link:hover .upgrade-icon {
    animation: sparkle 1.5s ease-in-out 3;
}

#main-nav.collapsed .board-nav-item.upgrade-link:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(52, 199, 128, 0.6);
}

/* Sparkle animation for collapsed icon */
@keyframes sparkle {
    0%, 100% { 
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
    50% { 
        transform: scale(1.15) rotate(5deg);
        filter: brightness(1.3);
    }
}

/* Tooltip for collapsed state */
#main-nav.collapsed .board-nav-item.upgrade-link::after {
    content: attr(title);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #23272a;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

#main-nav.collapsed .board-nav-item.upgrade-link:hover::after {
    opacity: 1;
}

/* Dark theme for upgrade link */
.theme-dark .board-nav-item.upgrade-link {
    background: linear-gradient(135deg, #34C780 0%, #2ca36c 100%);
    box-shadow: 0 2px 8px rgba(52, 199, 128, 0.4);
}

.theme-dark .board-nav-item.upgrade-link:hover {
    background: linear-gradient(135deg, #2ca36c 0%, #34C780 100%);
    box-shadow: 0 4px 12px rgba(52, 199, 128, 0.6);
}

.theme-dark .board-nav-item.upgrade-link a {
    color: #ffffff !important;
}

.theme-dark #main-nav.collapsed .board-nav-item.upgrade-link {
    box-shadow: 0 3px 10px rgba(52, 199, 128, 0.5);
}

.theme-dark #main-nav.collapsed .board-nav-item.upgrade-link:hover {
    box-shadow: 0 4px 16px rgba(52, 199, 128, 0.7);
}

.create-new-board {
    padding: 4px 8px;
    background: #f0f1f2 !important; /* force neutral */
    color: #333 !important;         /* force text color */
    border: 1px solid #e5e5e5 !important;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    background-image: none !important; /* prevent gradients */
    box-shadow: none !important;
}

/* Columns container and equal gutters */
.vstat-board {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 0 16px 16px 16px; /* equal left/right gutters, slightly smaller */
}

.vstat-column {
    flex: 1 1 0;
    min-width: 240px;
}

#main-nav:not(.expanded) .create-new-board {
    justify-content: center;
    padding: 8px;
    height: 32px;
}

#main-nav:not(.expanded) .create-new-board .create-text {
    display: none;
}

#main-nav.expanded .create-new-board .create-icon {
    display: inline-block;
}

.create-new-board .create-icon {
    color: #666 !important;
    filter: grayscale(100%);
}

/* Keep neutral on hover/focus/active */
.create-new-board:hover,
.create-new-board:focus,
.create-new-board:active {
    background: #e9ecef !important;
    color: #333 !important;
    border-color: #dddddd !important;
}

.theme-dark .create-new-board,
html.theme-dark .create-new-board {
    background: #23272a !important; /* darker to avoid glowing */
    color: #cfd3d7 !important;      /* slightly dimmer text */
    border: 1px solid #2b3136 !important;
    background-image: none !important;
}
.theme-dark .create-new-board .create-icon,
html.theme-dark .create-new-board .create-icon {
    color: #aaaaaa !important;
}
.theme-dark .create-new-board:hover,
.theme-dark .create-new-board:focus,
.theme-dark .create-new-board:active,
html.theme-dark .create-new-board:hover,
html.theme-dark .create-new-board:focus,
html.theme-dark .create-new-board:active {
    background: #2a2f34 !important; /* subtle hover */
    color: #d6dadd !important;
    border-color: #32383d !important;
}

/* Dark theme: keep add-icon green like in light theme */
.theme-dark .group-controls .add-icon,
html.theme-dark .group-controls .add-icon {
    background: linear-gradient(135deg, #34C780 0%, #2fb373 100%) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 1px 4px rgba(52, 199, 128, 0.3) !important;
}

.theme-dark .group-controls .add-icon:hover,
html.theme-dark .group-controls .add-icon:hover {
    box-shadow: 0 2px 8px rgba(52, 199, 128, 0.4) !important;
}

.theme-dark .group-controls .add-icon:active,
html.theme-dark .group-controls .add-icon:active {
    box-shadow: 0 1px 3px rgba(52, 199, 128, 0.3) !important;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #34C780;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#add-item-modal, #edit-modal, #edit-item-modal {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    min-width: 300px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

#add-item-modal h3, #edit-modal h3, #edit-item-modal h3 {
    margin: 0 0 15px;
    font-size: 18px;
    color: #424b4f;
}

#add-item-modal label, #edit-modal label, #edit-item-modal label {
    display: block;
    margin: 10px 0 5px;
    font-weight: 500;
    color: #424b4f;
}

#add-item-modal input, #edit-modal input, #edit-item-modal input {
    width: 94%;
    padding: 8px;
    border: 1px solid #ccd1d4;
    border-radius: 4px;
    font-size: 14px;
}

#add-item-modal button, #edit-modal button, #edit-item-modal button {
    margin-top: 15px;
    margin-right: 10px;
}

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

.modal-buttons button {
    margin: 0;
}

.vstat-group button, .vstat-group a, .vstat-group input {
    cursor: pointer;
}

#boards-list {
    margin-top: 8px;
    padding: 0 12px;
    display: block; /* Changed from display: none to ensure visibility in collapsed state */
}

.board-title-full {
    display: none;
}

.board-title-truncated {
    display: inline-block;
    width: 24px;
    text-align: center;
}

#main-nav.expanded .board-title-full {
    display: inline-block;
}

#main-nav.expanded .board-title-truncated {
    display: none;
}

.board-nav-item {
    display: flex;
    align-items: center;
}

/* Ensure board-nav-item is compact in collapsed state */
#main-nav.collapsed .board-nav-item {
    padding: 4px 8px;
    justify-content: center; /* Center the truncated title in collapsed state */
}

/* Hide edit/delete buttons in collapsed state */
#main-nav.collapsed .edit-board-btn,
#main-nav.collapsed .delete-board-btn {
    display: none !important; /* Override hover visibility in collapsed state */
}

.edit-item-btn,
.edit-icon,
.delete-icon {
    pointer-events: auto; /* Explicitly ensure pointer events are enabled (overrides any potential conflicts) */
    z-index: 2; /* Ensures the button is stacked above the link */
}

.edit-item-btn:hover,
.edit-icon:hover,
.delete-icon:hover {
    background: rgba(52, 199, 128, 0.15); /* Subtle hover feedback to confirm the area */
}

/* For dark theme adjustments */
body.theme-dark .edit-item-btn:hover,
body.theme-dark .edit-icon:hover,
body.theme-dark .delete-icon:hover {
    background: rgba(52, 199, 128, 0.25);
}

/* Header user menu */
.header-buttons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-menu {
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#user-menu-label {
    display: inline-block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.user-btn .caret {
    font-size: 12px;
    opacity: 0.8;
}

.user-menu-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: #fff;
    border: 1px solid #e2e5e8;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    padding: 6px;
    z-index: 1200;
}

body.theme-dark .user-menu-dropdown,
html.theme-dark .user-menu-dropdown {
    background: #23272a;
    border-color: #2b3136;
}

.user-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

body.theme-dark .user-menu-item { color: #e0e0e0; }

.user-menu-item:hover {
    background: #f0f1f2;
}

body.theme-dark .user-menu-item:hover { background: #2c3136; }

.hidden { display: none; }

/* Temporarily hide Edit button */
#edit-mode-btn {
    display: none !important;
}

/* Search results dropdown */
.search-container {
    position: relative;
    width: 220px; /* keep search box stable */
    margin-right: auto;
    margin-left: 10px;
}
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    margin-top: 6px;
    box-shadow: 0 8px 24px rgba(140,149,159,0.2);
    max-height: 300px;
    overflow: auto;
}
body.theme-dark .search-results {
    background: #1f2428;
    border-color: #30363d;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.search-result-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
    color: #24292f;
}
body.theme-dark .search-result-item { color: #e6edf3; }
.search-result-item:hover { background: #f6f8fa; }
body.theme-dark .search-result-item:hover { background: #2c3136; }
.search-result-item.group { font-weight: 600; }
.search-result-empty { padding: 8px 10px; color: #57606a; font-size: 13px; }
body.theme-dark .search-result-empty { color: #8b949e; }

/* Highlight target group on jump */
.vstat-group.highlight {
    outline: 2px solid #0969da;
    outline-offset: 2px;
    transition: outline-color 0.3s ease;
}

/* Hide add-board and delete-board UI */
/*.create-new-board { display: none !important; }
.delete-board-btn { display: none !important; }
#create-new-board-empty-btn { display: none !important; }*/

/* Keep the search input width constant */
#search { width: 220px; }



.vertical-dots{
    display:block;
    background: transparent;
    border: unset;
    margin: unset;
    padding: unset;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}
.vertical-dots > svg {
    transition: transform 0.2s ease;
    cursor: pointer;
}

.vertical-dots > svg:hover {
    transform: scale(1.1);
}

@media screen and (max-width: 650px) {
    .vstat-group-title{
        padding-right: 20px;
    }

    .header-container{
        flex-wrap: wrap;
        gap: 10px;
        height: unset;
        justify-content: center;
    }
    .search-container{
        margin-left: unset;
        margin-right: unset;
    }
    #global-header{
        height: 84px;
    }
    #user-menu-dropdown{
        position: fixed;
        top: 84px;
    }
    #main-nav{
        top: 84px;
    }
    #top-notification{
        position: fixed;
        bottom: 10px;
        max-width: 100vw;
    }

    .user-menu{
        max-width: 120px;
    }


    /*mobilization*/
    .edit-item-btn{
        font-size: 24px;
    }
    .vstat-link a{
        height: 40px;
        font-size: 15px;
    }
    .vstat-link > a{
        max-width: calc(100% - 22px) !important;
    }


    .group-controls {
        display: none;
        top: 0px;
        transform: unset;
        width: 100%;
        flex-direction: column;
        align-items: inherit;
        width: 30px;
        margin-top: 30px;
    }
    .group-controls > button{
        width: 100% !important;
        height: 30px !important;
    }


    .edit-item-btn{
        position: absolute;
        background: linear-gradient(135deg, #43CCF8 0%, #3bb8e6 100%);
        box-shadow: 0 1px 4px rgba(67, 204, 248, 0.3);
        color: white;
        top: 22px;
        right: 0px;
    }

    .group-controls, .vertical-dots, .edit-item-btn, .group-controls > button{
        display:none !important;
    }
}
.vertical-dots{
    display:none;
}
.group-controls.visible {
    display: flex;
}
/*
.vertical-dots:hover ~ .edit-item-btn {
    display: block !important;
}*/



@media screen and (min-width: 800px) {
    .vstat-column {
        height: 100%;
        min-height: 150px;
    }
}
