body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f9;
    color: #333;
    margin-left: 250px; /* Width of the sidebar */
}

/* Sidebar Styles */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 250px;
    background-color: #2c3e50;
    color: #ecf0f1;
    overflow-x: hidden;
    padding-top: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: #ecf0f1;
}

/* Sidebar Group Styles */
.sidebar-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    cursor: pointer;
    color: #ecf0f1;
    font-weight: bold;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}
.sidebar-group-header:hover {
    background-color: #34495e;
}
.sidebar-group-chevron {
    font-size: 0.7em;
    transition: transform 0.2s;
}
.sidebar-group.collapsed .sidebar-group-links {
    display: none;
}
.sidebar-group.collapsed .sidebar-group-chevron {
    transform: rotate(-90deg);
}
.sidebar-group-links {
    display: block;
}
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 30px;
    text-decoration: none;
    color: #bdc3c7;
    transition: background-color 0.3s, color 0.3s;
    font-size: 0.95em;
}
.sidebar-link:hover {
    background-color: #34495e;
    color: #ecf0f1;
}
.sidebar-link.active {
    background-color: #007bff;
    color: white;
}
.sidebar-link-icon {
    width: 20px;
    text-align: center;
    margin-right: 8px;
}

/* Content Styles */
h1 {
    margin-top: 0;
}

.panel-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.panel {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-width: 250px;
    flex: 1;
}

.panel h2 {
    margin-top: 0;
}

.list-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item:hover {
    background-color: #f9f9f9;
}

.list-item.selected {
    background-color: #e7f3ff;
    border-left: 4px solid #007bff;
}

.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
}

.hidden {
    display: none;
}

button {
    padding: 5px 10px;
    cursor: pointer;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
}

button:hover {
    background-color: #ddd;
}

.add-form {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

input[type="text"], input[type="color"], select, textarea {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.dashboard-panel {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.task-list {
    max-height: 400px;
    overflow-y: auto;
}
.task-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.task-item:last-child {
    border-bottom: none;
}
.task-item:hover {
    background-color: #f9f9f9;
}
.task-meta {
    font-size: 0.85em;
    color: #666;
}
.gantt-container {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
}
.countdown {
    font-weight: bold;
    font-size: 0.9em;
}
.countdown.urgent {
    color: red;
}

/* Gantt Specifics */
.gantt-chart {
    display: grid;
    /* Grid columns will be set dynamically via JS */
    border: 1px solid #ddd;
    margin-top: 10px;
    position: relative;
}
.gantt-header-row {
    display: contents;
    font-weight: bold;
    background: #f0f0f0;
}
.gantt-header-cell {
    padding: 5px;
    text-align: center;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    font-size: 0.8em;
}
.gantt-task-row {
    display: contents;
}
.gantt-task-label {
    padding: 5px;
    border-bottom: 1px solid #eee;
    border-right: 1px solid #ddd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: sticky;
    left: 0;
    background: white;
    z-index: 10;
}
.gantt-bar-container {
    position: relative;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}
.gantt-bar {
    position: absolute;
    height: 20px;
    top: 5px;
    border-radius: 4px;
    color: white;
    font-size: 0.75em;
    padding-left: 5px;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}
.gantt-grid-lines {
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    pointer-events: none;
    display: flex;
}
.gantt-grid-line {
    border-right: 1px dashed #eee;
    flex: 1;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal.hidden {
    display: none;
}
.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
/* Delete Button Styles */
.delete-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2em;
    font-weight: bold;
    padding: 0 5px;
    border-radius: 4px;
    margin-left: 10px;
}

.delete-btn:hover {
    color: #dc3545;
    background-color: #ffe6e6;
}

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

.edit-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2em;
    cursor: pointer;
}

.edit-btn:hover {
    color: #007bff;
    background-color: #e7f3ff;
    border-radius: 4px;
}

.edit-input {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}

/* Notes Styles */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.note-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.note-card h3 {
    margin: 0;
    font-size: 1.1em;
}

.note-preview {
    color: #666;
    font-size: 0.9em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.tag-badge {
    background-color: #e7f3ff;
    color: #007bff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    display: inline-block;
}

.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Search Result Styles */
.search-result-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.search-result-item:hover {
    background-color: #f9f9f9;
}

.search-result-item h3 {
    margin: 0 0 5px 0;
    color: #007bff;
}

.search-result-snippet {
    font-size: 0.9em;
    color: #555;
    line-height: 1.4;
}

.search-result-snippet b {
    background-color: #fff3cd;
    padding: 0 2px;
}

/* Inspire Tree Icons */
.icon-folder::before {
    content: "📁 ";
}
.icon-doc::before {
    content: "📄 ";
}

/* ─── Toast Notifications ─── */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-size: 0.9em;
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.3s, transform 0.3s;
    max-width: 360px;
    word-break: break-word;
}
.toast.show {
    opacity: 1;
    transform: translateX(0);
}
.toast-info    { background: #007bff; }
.toast-success { background: #28a745; }
.toast-error   { background: #dc3545; }

/* ─── Loading Overlay ─── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #ddd;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Tab Styles (creations, entities) ─── */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}
.tab {
    padding: 10px 20px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -1px;
}
.tab:hover {
    background-color: #f9f9f9;
}
.tab.active {
    background-color: white;
    border-color: #ddd;
    border-bottom-color: white;
    font-weight: bold;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* ─── Form Grid (variables, snippets) ─── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
    margin-bottom: 20px;
}
.form-grid label {
    align-self: center;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* ─── Button Utilities ─── */
.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-primary:hover {
    background-color: #0069d9;
}
.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-danger:hover {
    background-color: #c82333;
}
.btn-success {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}
.btn-success:hover {
    background-color: #218838;
}

/* ─── Page Header ─── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* ─── Layout Utilities ─── */
.flex-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.flex-wrap {
    flex-wrap: wrap;
}
.w-full {
    width: 100%;
}
.text-muted {
    color: #666;
    font-size: 0.85em;
}

/* ─── Modal Variants ─── */
.modal-wide {
    min-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-xl {
    min-width: 800px;
    max-height: 90vh;
}

/* ─── Creator Styles ─── */
.task-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
    cursor: pointer;
}
.task-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.dt-picker-container {
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 4px;
    background: #f9f9f9;
}
.dt-date-input {
    margin-bottom: 10px;
    width: 100%;
    padding: 5px;
}
.dt-time-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dt-row {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.dt-row-label {
    font-weight: bold;
    min-width: 30px;
    text-align: right;
    margin-right: 5px;
}
.dt-cell {
    padding: 5px 8px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: white;
    font-size: 0.9em;
    min-width: 25px;
    text-align: center;
}
.dt-cell:hover {
    background-color: #eef;
}
.dt-cell.selected {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}

/* ─── Documents Styles ─── */
.search-container {
    margin-bottom: 20px;
}
#document-search {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
#column-container {
    display: flex;
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
    height: 500px;
    width: 100%;
}
.column {
    min-width: 250px;
    max-width: 250px;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    background: #fff;
    flex-shrink: 0;
}
.column-header {
    padding: 10px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
    color: #555;
}
.column-list {
    overflow-y: auto;
    flex-grow: 1;
    padding: 0;
    margin: 0;
    list-style: none;
}
.column-item {
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #fcfcfc;
    user-select: none;
}
.column-item:hover {
    background-color: #f0f7ff;
}
.column-item.selected {
    background-color: #007bff;
    color: white;
}
.item-icon {
    margin-right: 8px;
    font-size: 1.2em;
}
.item-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item-arrow {
    margin-left: 5px;
    font-size: 0.8em;
    color: #999;
}
.column-item.selected .item-arrow {
    color: #ccc;
}
.add-folder-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: #007bff;
    padding: 0 5px;
}
.add-folder-btn:hover {
    color: #0056b3;
}
.column-item.drag-over {
    background-color: #e0ffe0 !important;
    outline: 2px solid #28a745;
}
.column.drag-over-column {
    box-shadow: inset 0 0 0 2px #007bff;
    background-color: #f8fbff;
}
.column-item .item-actions {
    margin-left: auto;
    display: none;
    gap: 2px;
}
.column-item:hover .item-actions {
    display: flex;
}
.column-item .item-actions button {
    padding: 1px 4px;
    font-size: 0.7em;
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 2px;
    cursor: pointer;
}
.column-item.selected .item-actions button {
    color: #333;
}
.pinned-panel {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 15px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.pinned-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}
.pinned-card {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 6px;
    width: 200px;
    position: relative;
    background: #fdfdfd;
    transition: transform 0.2s;
}
.pinned-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.pinned-card h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.unpin-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 1.2em;
    cursor: pointer;
    border: none;
    background: none;
    color: #ff9800;
}
.pinned-date {
    font-size: 0.8em;
    color: #777;
}

/* ─── Editor Styles ─── */
.editor-container {
    display: flex;
    height: 80vh;
    gap: 20px;
}
#editor {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    font-size: 14px;
}
#preview {
    flex: 1;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 20px;
    overflow: auto;
    background: #f9f9f9;
}
.cm-editor { height: 100%; }
.cm-scroller { overflow: auto; }

/* ─── Assignees Max Width ─── */
.panel-narrow {
    max-width: 400px;
}
