:root {
    /* Light Mode Palette */
    --bg-color: #fdfaf6;
    --sidebar-bg: #f5f0e6;
    --card-bg: #ffffff;
    --text-main: #2d2d2d;
    --text-main-rgb: 45, 45, 45;
    --text-muted: #6b6b6b;
    --accent: #8da47e;
    /* Sage Green */
    --accent-rgb: 141, 164, 126;
    --accent-hover: #7b916c;
    --border-color: #e8e1d5;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --danger-color: #e74c3c;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* Dark Mode Palette - Soft Charcoal & Espresso */
    --bg-color: #121212;
    --sidebar-bg: #1c1c1c;
    --card-bg: #242424;
    --text-main: #e0d7c7;
    --text-main-rgb: 224, 215, 199;
    --text-muted: #a09586;
    --accent: #a3b593;
    --accent-rgb: 163, 181, 147;
    --accent-hover: #b5c5a7;
    --border-color: #333333;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(28, 28, 28, 0.7);
    --danger-color: #ff5252;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    transition: var(--transition);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: var(--transition);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--card-bg);
    color: var(--text-main);
    box-shadow: var(--shadow);
}

.nav-item.active {
    color: var(--accent);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
}

/* Dashboard Full-Width Override */
#view-home {
    padding: 0 !important;
}

#view-home .grid-stack {
    margin: 0;
    width: 100% !important;
    max-width: none !important;
}


.content-view {
    display: none;
    flex-direction: column;
    flex: 1;
    /* Allow content to grow */
    animation: fadeIn 0.4s ease-out;
}

.content-view.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.welcome-msg h1 {
    font-size: 28px;
    font-weight: 600;
}

.welcome-msg p {
    color: var(--text-muted);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* Project Sub-Navigation */
.project-sub-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    padding: 6px;
    background-color: var(--sidebar-bg);
    width: fit-content;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.sub-nav-item {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.sub-nav-item:hover {
    color: var(--text-main);
}

.sub-nav-item.active {
    background-color: var(--card-bg);
    color: var(--accent);
    box-shadow: var(--shadow);
}

/* Kanban Board Styling */
.kanban-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
}

.kanban-column {
    flex: 0 0 280px;
    /* Fixed width for 5 columns to be scrollable */
    background-color: var(--bg-color);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border-color);
    min-height: 400px;
}

.bento-tile h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

/* Environment Tile */
.tile-env {
    background: linear-gradient(135deg, var(--sidebar-bg), var(--bg-color));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.clock-display {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -1px;
}

.weather-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.weather-city {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    opacity: 0.6;
}

.weather-temp {
    font-size: 20px;
    font-weight: 700;
}

.weather-desc {
    font-size: 12px;
    opacity: 0.8;
}

/* Activity Feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: rgba(var(--text-main-rgb), 0.03);
    border-radius: var(--radius-sm);
    font-size: 13px;
    align-items: flex-start;
}

.activity-icon {
    font-size: 16px;
    margin-top: 2px;
}

.activity-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.activity-desc {
    color: var(--text-main);
}

.activity-time {
    font-size: 10px;
    color: var(--text-muted);
}

/* Work Balance Tile */
.tile-balance {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: center;
    background: linear-gradient(135deg, var(--sidebar-bg), rgba(var(--accent-rgb), 0.1));
}

.balance-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
}

.balance-value {
    font-size: 36px;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--accent);
}

.balance-value.negative {
    color: var(--danger-color);
}

.balance-value.positive {
    color: #10b981;
}

.balance-label {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
}

.balance-footer {
    font-size: 11px;
    color: var(--text-muted);
}

.chart-container {
    width: 100%;
    height: 100%;
    min-height: 200px;
    position: relative;
}

/* Sub-tasks Styling (Alpha 0.4) */
.subtasks-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(var(--text-main-rgb), 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.subtask-item:hover {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.05);
}

.subtask-item.completed {
    opacity: 0.6;
}

.subtask-item.completed .subtask-text {
    text-decoration: line-through;
}

.subtask-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

.subtask-text {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.subtask-delete {
    opacity: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--danger-color);
    padding: 4px;
    transition: var(--transition);
}

.subtask-item:hover .subtask-delete {
    opacity: 1;
}

.subtask-placeholder {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
}

/* Personal View Styling (Alpha 0.5) */
.personal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.reports-card {
    min-width: 400px;
}

.report-controls {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-top: 20px;
    margin-bottom: 12px;
}

.report-controls .form-group {
    flex: 1;
}

.report-note {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}




.kanban-column h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kanban-card {
    background-color: var(--card-bg);
    padding: 12px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.kanban-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.kanban-card.is-updating {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(1);
    transform: scale(0.98);
}

/* SortableJS Classes for Kanban */
.kanban-ghost {
    opacity: 0.2;
    background: var(--accent) !important;
    border: 2px dashed var(--accent) !important;
}

.kanban-chosen {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    background: var(--card-bg);
}


.kanban-card h4 {
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-main);
}

.kanban-card .card-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

/* Home Grid & Quick Links */
.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

@media (max-width: 1024px) {
    .home-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 16px;
}

.quick-link-item-container {
    position: relative;
    display: flex;
    flex-direction: column;
}

.quick-link-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background-color: var(--bg-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

.quick-link-item:hover {
    background-color: var(--card-bg);
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.quick-link-item img,
.quick-link-item span.icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* Priority Table Indicators */
.gridjs-td {
    padding: 12px 15px !important;
    position: relative;
}

.priority-row-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    padding-left: 10px;
}

.priority-stripe {
    position: absolute;
    left: -15px;
    top: -12px;
    bottom: -12px;
    width: 4px;
    border-radius: 0 4px 4px 0;
}

.priority-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    font-family: 'Outfit', sans-serif;
}

/* Priority Colors */
.priority-urgent .priority-stripe, .priority-urgent .priority-circle { background-color: #ff4757; color: white; }
.priority-high .priority-stripe, .priority-high .priority-circle { background-color: #ffa502; color: white; }
.priority-medium .priority-stripe, .priority-medium .priority-circle { background-color: #2f3542; color: white; }
.priority-low .priority-stripe, .priority-low .priority-circle { background-color: #747d8c; color: white; }

/* Light mode overrides for circles if needed */
[data-theme="light"] .priority-circle {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.project-name-text {
    font-weight: 600;
    color: var(--text-main);
}

.quick-link-item .label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.btn-delete-small {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--danger-color, #ff4d4d);
    color: white;
    border: 2px solid var(--bg-color);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    font-weight: bold;
    z-index: 10;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.btn-delete-small:hover {
    transform: scale(1.1);
    background-color: #ff3333;
}

.quick-link-item-container:hover .btn-delete-small,
.selection-item:hover .btn-delete-small {
    display: flex;
}

/* SortableJS Styles */
.sortable-ghost {
    opacity: 0.4;
    background: var(--accent) !important;
}

.sortable-chosen {
    cursor: grabbing;
}

/* SQL Manager */
.sql-input-section {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sql-input-section textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    color: var(--text-main);
    resize: vertical;
}

.sql-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.settings-header h3 {
    margin: 0;
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.sql-card {
    background-color: var(--bg-color);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    position: relative;
    max-height: 250px;
    display: flex;
    flex-direction: column;
}

.sql-card h4 {
    margin-bottom: 12px;
    padding-right: 24px;
}

.sql-card pre {
    background-color: var(--card-bg);
    padding: 12px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    font-family: inherit;
    font-size: 13px;
    margin: 0;
    color: var(--accent);
}

.sql-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
}

.sql-actions .btn-icon {
    font-size: 14px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.btn-edit-sql {
    color: var(--text-main);
}

.btn-delete-sql {
    color: var(--danger-color);
}

.copy-btn {
    color: var(--primary-color);
}

/* GTK Section */
.gtk-container {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0;
    /* Important for flex child with overflow */
}

.gtk-sidebar {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gtk-preview {
    flex-grow: 1;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gtk-preview embed,
.gtk-preview iframe {
    width: 100%;
    height: 100%;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.file-item {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pdf-delete-btn {
    opacity: 0;
    color: var(--danger-color);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: var(--transition);
}

.file-item:hover .pdf-delete-btn {
    opacity: 1;
}

.pdf-delete-btn:hover {
    transform: scale(1.2);
}

.file-item:hover,
.file-item.active {
    background-color: var(--card-bg);
    border-color: var(--accent);
}

/* Settings Tabs */
.settings-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.settings-nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    transition: var(--transition);
}

.settings-nav-item.active {
    color: var(--accent);
    box-shadow: 0 2px 0 var(--accent);
}

.settings-subview {
    display: none;
}

.settings-subview.active {
    display: block;
}

.selection-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: relative;
    /* Fixed: Absolute children will now anchor here */
}

.selection-info {
    display: flex;
    gap: 24px;
    flex-grow: 1;
}

.selection-item .category-tag {
    background-color: var(--sidebar-bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
}

/* General Utilities */
.coming-soon {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-style: italic;
}

.placeholder {
    color: var(--text-muted);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: var(--transition);
}

.btn-icon:hover {
    background-color: var(--accent);
    color: white;
}

select {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-main);
    outline: none;
}

/* Dashboard Cards */
.board-container {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    width: 100%;
}

.task-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

input[type="text"] {
    flex-grow: 1;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-main);
    outline: none;
    transition: var(--transition);
}

input[type="text"]:focus {
    border-color: var(--accent);
}

button.primary {
    padding: 12px 24px;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

button.primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.task-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
    transition: var(--transition);
}

.task-item:last-child {
    border-bottom: none;
}

.task-item:hover {
    background-color: rgba(141, 164, 126, 0.05);
}

.checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.checkbox.checked {
    background-color: var(--accent);
}

.checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
}

.task-text {
    flex-grow: 1;
    font-size: 16px;
}

.task-text.done {
    text-decoration: line-through;
    color: var(--text-muted);
}

.delete-btn {
    opacity: 0;
    cursor: pointer;
    color: #ff6b6b;
    font-weight: 800;
    padding: 4px 8px;
    transition: var(--transition);
}

.task-item:hover .delete-btn {
    opacity: 1;
}

/* Theme Toggle Button */
#theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    font-size: 14px;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 32px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.modal-content h2 {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: rgba(var(--text-main-rgb), 0.04);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
    cursor: pointer;
}

.form-group select option {
    background-color: var(--card-bg);
    color: var(--text-main);
    padding: 12px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    background-color: var(--card-bg);
    box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.1);
}

.form-group textarea {
    resize: vertical;
    font-family: inherit;
    line-height: 1.5;
}

.form-actions,
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

.btn-secondary {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

.btn-danger {
    padding: 12px 24px;
    background-color: var(--danger-color);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.btn-danger:hover {
    background-color: #d32f2f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

/* Grid.js Customization */
.gridjs-container {
    padding: 0;
    color: var(--text-main) !important;
}

.gridjs-wrapper {
    border: none !important;
    border-radius: var(--radius-md);
}

.gridjs-th {
    background-color: var(--sidebar-bg) !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    border: none !important;
}

.gridjs-td {
    background-color: var(--card-bg) !important;
    color: var(--text-main) !important;
    border: none !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.gridjs-tr:last-child .gridjs-td {
    border-bottom: none !important;
}

.gridjs-footer {
    background-color: var(--sidebar-bg) !important;
    border: none !important;
    color: var(--text-muted) !important;
    padding: 12px 24px !important;
    border-top: 1px solid var(--border-color) !important;
}

.gridjs-summary {
    color: var(--text-muted) !important;
}

.gridjs-pages button {
    background-color: var(--bg-color) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    transition: var(--transition) !important;
}

.gridjs-pages button:hover {
    background-color: var(--card-bg) !important;
    border-color: var(--accent) !important;
}

.gridjs-pages button.gridjs-currentPage {
    background-color: var(--accent) !important;
    color: white !important;
    border-color: var(--accent) !important;
}

/* Modal Actions for centering */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Selection Info 50% width adjustment */
.selection-info {
    display: flex;
    gap: 24px;
    flex-grow: 1;
}

.selection-info span:last-child {
    flex: 1;
    min-width: 50%;
}

.gridjs-head {
    padding-bottom: 16px !important;
}

.gridjs-search-input {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
    background-color: var(--bg-color) !important;
    color: var(--text-main) !important;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    min-width: 280px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--sidebar-bg);
    border-left: 4px solid var(--accent);
    color: var(--text-main);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toast-in 0.3s ease forwards;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.toast.success {
    border-left-color: #10b981;
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.info {
    border-left-color: var(--accent);
}

@keyframes toast-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-out {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-out {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.dashboard-toolbar {
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(var(--card-bg-rgb), 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
    z-index: 10;
}

.grid-stack {
    width: 100% !important;
    min-height: 800px;
    background-image:
        linear-gradient(rgba(var(--text-main-rgb), 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(var(--text-main-rgb), 0.05) 1px, transparent 1px);
    /* 8 columns at 100% width. Row height 110px to match JS cellHeight. */
    background-size: calc(100% / 8) 110px;
    background-position: left top;

    position: relative;
    padding: 10px;
    transition: background-color 0.3s;
}

.grid-stack.edit-mode-active {
    background-color: rgba(var(--accent-rgb), 0.05);
}


/* GridStack 8-column Core Overrides (Fail-safe) */
.grid-stack>.grid-stack-item {
    min-width: 0;
    position: absolute !important;
}

/* Drag Handle Styling */
.drag-handle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--accent);
    color: white;
    display: none;
    /* Changed to none for absolute safety */
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: grab;
    z-index: 20;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
    box-shadow: 0 4px 8px rgba(var(--accent-rgb), 0.3);
}

.edit-mode-active .drag-handle {
    display: flex;
    /* Only show in edit mode */
}


.edit-mode-active .grid-stack-item-content {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
}

/* Premium Resize Handle (Alpha 0.8.12) */
.ui-resizable-handle.ui-resizable-se {
    width: 24px !important;
    height: 24px !important;
    right: 2px !important;
    bottom: 2px !important;
    background-image: none !important;
    /* Hide old icon */
    display: none !important;
    align-items: center;
    justify-content: center;
    cursor: nwse-resize;
    z-index: 25;
}

.edit-mode-active .ui-resizable-handle.ui-resizable-se {
    display: flex !important;
}

.ui-resizable-handle.ui-resizable-se::after {
    content: "";
    width: 10px;
    height: 10px;
    border-right: 3px solid var(--accent);
    border-bottom: 3px solid var(--accent);
    border-bottom-right-radius: 2px;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.ui-resizable-handle.ui-resizable-se:hover::after {
    opacity: 1;
    width: 12px;
    height: 12px;
    transform: translate(1px, 1px);
}


/* Iron Width Protection (Alpha 0.8.6) - Forced 8-column geometry only when NOT moving */
.grid-stack>.grid-stack-item:not(.ui-draggable-dragging):not(.ui-resizable-resizing):not(.grid-stack-placeholder) {
    min-width: calc(100% / 8) !important;
    position: absolute !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="1"] {
    width: calc(100% / 8 * 1) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="2"] {
    width: calc(100% / 8 * 2) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="3"] {
    width: calc(100% / 8 * 4) !important;
}

/* Adjusted grid for 8 */
.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="3"] {
    width: calc(100% / 8 * 3) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="4"] {
    width: calc(100% / 8 * 4) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="5"] {
    width: calc(100% / 8 * 5) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="6"] {
    width: calc(100% / 8 * 6) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="7"] {
    width: calc(100% / 8 * 7) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-w="8"] {
    width: 100% !important;
}

/* X-Pos Iron Helpers - Exempt while dragging */
.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-x="1"] {
    left: calc(100% / 8 * 1) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-x="2"] {
    left: calc(100% / 8 * 2) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-x="3"] {
    left: calc(100% / 8 * 3) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-x="4"] {
    left: calc(100% / 8 * 4) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-x="5"] {
    left: calc(100% / 8 * 5) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-x="6"] {
    left: calc(100% / 8 * 6) !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-x="7"] {
    left: calc(100% / 8 * 7) !important;
}

/* Y-Pos Iron Helpers - Exempt while dragging (Alpha 0.8.9) - 110px Rows */
.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="0"] {
    top: 10px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="1"] {
    top: 120px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="2"] {
    top: 230px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="3"] {
    top: 340px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="4"] {
    top: 450px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="5"] {
    top: 560px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="6"] {
    top: 670px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="7"] {
    top: 780px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="8"] {
    top: 890px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="9"] {
    top: 1000px !important;
}

.grid-stack>.grid-stack-item:not(.ui-draggable-dragging)[gs-y="10"] {
    top: 1110px !important;
}




/* Compact 1x1 Layout Optimizations */
.grid-stack-item[gs-w="1"] .card-header h3,
.grid-stack-item[gs-h="1"] .card-header h3 {
    font-size: 11px !important;
    max-width: 60px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grid-stack-item[gs-w="1"] .balance-footer,
.grid-stack-item[gs-w="1"] .weather-desc,
.grid-stack-item[gs-w="1"] .weather-city,
.grid-stack-item[gs-w="1"] .date-tag,
.grid-stack-item[gs-w="1"] .btn-icon {
    display: none !important;
}

.grid-stack-item[gs-w="1"] .balance-value {
    font-size: 16px !important;
}

.grid-stack-item[gs-w="1"] .clock-display {
    font-size: 18px !important;
}

.grid-stack-item[gs-w="1"][gs-h="1"].tile-deadline .deadline-box h4 {
    font-size: 12px !important;
}

.grid-stack-item[gs-w="1"] .welcome-content h1 {
    font-size: 14px !important;
    /* Smaller for 1x2 */
}

.grid-stack-item[gs-w="1"] #current-day-info {
    display: none !important;
    /* Hide long date in narrow vertical view */
}

.grid-stack-item[gs-w="1"] .grid-stack-item-content {
    padding: 10px !important;
}


/* 1x2 and Narrow-Tall Vertical Layouts */
.grid-stack-item .grid-stack-item-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 15px !important;
}

.stat-val {
    font-size: 24px !important;
    font-weight: 700 !important;
    color: var(--accent);
    display: block;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 11px !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.grid-stack-item[gs-w="1"] .welcome-content h1 {
    font-size: 14px !important;
}


.grid-stack-item[gs-w="1"] .tile-welcome {
    flex-direction: column !important;
    padding: 20px 10px !important;
    gap: 10px;
}

.grid-stack-item[gs-w="1"] .tile-welcome h1 {
    font-size: 18px !important;
    margin-bottom: 5px;
}

.grid-stack-item[gs-w="1"] .welcome-main {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.grid-stack-item[gs-w="1"] .stats-mini-grid {
    grid-template-columns: 1fr;
    gap: 8px;
}

.grid-stack-item[gs-w="1"] .tile-env {
    flex-direction: column !important;
    justify-content: center;
    gap: 15px;
}


.grid-stack-item-content {
    inset: 5px;
    /* Proper gutter within GS bounds */
    background: rgba(var(--card-bg-rgb), 0.8) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-sm) !important;
    overflow: hidden;
}



.grid-stack-item-content:hover {
    box-shadow: var(--shadow-md) !important;
}

/* Custom Resize Handle styling */
.ui-resizable-handle {
    filter: invert(var(--dark-mode-invert));
    opacity: 0.3;
    transition: opacity 0.2s;
}

.grid-stack-item:hover .ui-resizable-handle {
    opacity: 1;
}



/* Specific card adjustments for flexibility */
.tile-welcome {
    height: 100%;
    min-height: auto !important;
}

.tile-stats .chart-container {
    height: calc(100% - 60px);
}




.bento-tile {
    backdrop-filter: blur(12px);
    background: rgba(var(--card-bg-rgb), 0.8) !important;
    border: 1px solid var(--border-color);
    /* Transition removed to prevent drag-flicker and positioning lag */
}


.bento-tile:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    z-index: 10;
}



.tile-welcome {
    padding: 30px 40px !important;
    background: linear-gradient(135deg, var(--accent) 0%, #4facfe 100%) !important;
    color: white !important;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    min-height: 180px;
}

.welcome-content {
    flex: 1;
}

.tile-welcome h1 {
    color: white !important;
    margin-bottom: 8px;
    font-size: 28px;
}

/* Stats Tile (Modular in Alpha 0.9.0) */
.tile-stats {
    padding: 20px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    width: 100%;
}

/* Quick Links Adaptive Grid (Alpha 0.9.0) */
.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    padding: 10px;
    width: 100%;
    margin-top: 10px;
}


.stats-mini-grid .stat-box {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: var(--radius-md);
    text-align: center;
    color: white;
}

.stats-mini-grid .stat-val {
    color: white;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.stats-mini-grid .stat-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 4px;
}


.bento-tile {
    min-height: 160px;
    display: flex;
    flex-direction: column;
}


.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.stat-box {
    background: var(--bg-color);
    padding: 12px;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-val {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.deadline-box {
    margin-top: 10px;
}

.date-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

@media (max-width: 1200px) {
    .home-grid-bento {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
    }

    .tile-welcome,
    .tile-env,
    .tile-stats,
    .tile-quicklinks,
    .tile-balance,
    .tile-deadline,
    .tile-todo,
    .tile-activity {
        grid-column: span 2;
        grid-row: auto;
    }
}

@media (max-width: 768px) {
    .home-grid-bento {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .tile-welcome,
    .tile-env,
    .tile-stats,
    .tile-quicklinks,
    .tile-balance,
    .tile-deadline,
    .tile-todo,
    .tile-activity {
        grid-column: 1;
        grid-row: auto;
    }
}


.calendar-card {
    padding: 30px !important;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.calendar-nav {
    display: flex;
    gap: 10px;
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    background: rgba(var(--card-bg-rgb), 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.calendar-day {
    background: var(--card-bg);
    min-height: 130px;
    padding: 12px;
    position: relative;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar-day:hover {
    background: rgba(var(--accent-rgb), 0.02);
}

.calendar-day::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    opacity: 0;
}

.calendar-day:hover::after {
    width: 80%;
    opacity: 0.5;
}

.calendar-day.today::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    z-index: 1;
}

.calendar-day.other-month {
    opacity: 0.4;
    background: rgba(var(--text-main-rgb), 0.02);
}

.day-number {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
}

.day-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.day-hours-badge {
    background: rgba(var(--accent-rgb), 0.1);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.day-hours-badge:hover {
    background: var(--accent);
    color: white;
}

.day-hours-badge.target-reached {
    background: #10b981;
    color: white;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

/* Shift Details Styling */
.shift-details-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
}

.shift-item {
    background: rgba(var(--text-main-rgb), 0.03);
    padding: 12px;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--accent);
}

.shift-main {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.shift-place {
    font-weight: 700;
    font-size: 14px;
}

.shift-duration {
    font-weight: 700;
    color: var(--accent);
}

.shift-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

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

.shift-actions .btn-icon {
    padding: 2px;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.shift-actions .btn-icon:hover {
    opacity: 1;
}

.shift-meta .target {
    font-style: italic;
    opacity: 0.8;
}

.variance-over {
    color: #10b981;
    font-weight: 700;
}

.variance-under {
    color: #ef4444;
    font-weight: 700;
}

.variance-zero {
    color: var(--text-muted);
}

/* New: Multi-day Event Bars */
.calendar-event-bar {
    font-size: 11px;
    padding: 6px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.calendar-event-bar:hover {
    transform: translateY(-1.5px) scale(1.02);
    box-shadow: 0 6px 15px rgba(var(--accent-rgb), 0.35);
    filter: brightness(1.1);
}

.calendar-event-bar.status-finish {
    background: linear-gradient(135deg, #10b981, #059669);
}

.calendar-event-bar.status-in-progress {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.calendar-event-bar.status-planned {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.calendar-event-bar.status-hold {
    background: linear-gradient(135deg, #64748b, #475569);
}

.calendar-event-bar.status-waiting {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

[data-theme="dark"] .calendar-event-bar {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Animations */
@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.calendar-days-grid {
    animation: slideInUp 0.4s ease-out;
}

/* Spotlight Modal */
.spotlight-modal {
    align-items: flex-start !important;
    padding-top: 10vh;
}

.spotlight-modal .modal-content {
    width: 600px;
    max-width: 90%;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}

.search-icon {
    font-size: 20px;
    opacity: 0.5;
}

#spotlight-input {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-main);
    width: 100%;
    outline: none;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 12px 0;
    display: none;
}

.search-category {
    padding: 8px 0;
}

.search-category label {
    display: block;
    padding: 4px 24px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 1px;
    opacity: 0.8;
}

.results-list {
    display: flex;
    flex-direction: column;
}

.search-result-item {
    padding: 10px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
}

.search-result-item:hover {
    background: rgba(var(--accent-rgb), 0.05);
}

.search-result-item .icon {
    font-size: 16px;
}

.search-result-item .title {
    font-weight: 500;
    font-size: 14px;
}

.search-footer {
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 20px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

kbd {
    background: var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace
}

/* --- Premium Cozy Scrollbar --- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--accent-rgb), 0.4);
    border-radius: 10px;
    border: 3px solid var(--bg-color);
    transition: var(--transition);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid var(--card-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--accent-rgb), 0.7);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* --- Quick Tasks Premium Refinements --- */
.todo-list {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.todo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(var(--text-main-rgb), 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    width: 100%;
    flex-wrap: nowrap;
    gap: 15px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.todo-item:hover {
    background: rgba(var(--text-main-rgb), 0.06);
    transform: translateX(4px);
    border-color: var(--accent);
}

.todo-item span {
    flex-grow: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.todo-item.completed {
    opacity: 0.6;
}

.todo-item.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-item .todo-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s ease;
}

.todo-item:hover .todo-actions {
    opacity: 1;
    transform: translateX(0);
}

.btn-todo {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    border-radius: 8px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.btn-todo:hover {
    background: rgba(var(--text-main-rgb), 0.1) !important;
}

.btn-todo-complete {
    color: #10b981;
}

.btn-todo-delete {
    color: var(--danger-color);
}

/* === Sidebar Footer & Diagnostics === */
.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.diag-info {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    opacity: 0.7;
}

.diag-item {
    background: rgba(var(--primary-rgb), 0.1);
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
    font-family: monospace;
}

.diag-item.ok {
    color: #4ade80;
}

.diag-item.err {
    color: #f87171;
}

/* === Coming Soon === */
.coming-soon {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    font-size: 1.1rem;
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    margin: 24px;
    background: rgba(var(--primary-rgb), 0.02);
}

/* === Quick Tasks Scrollbar === */
.todo-list::-webkit-scrollbar {
    width: 6px;
}

.todo-list::-webkit-scrollbar-track {
    background: rgba(var(--primary-rgb), 0.05);
    border-radius: 10px;
}

.todo-list::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.4);
    border-radius: 10px;
}

.todo-list::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.7);
}

/* Settings Row */
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* --- Project Enhancements --- */

/* Tab Counters */
.sub-nav-item .counter {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 8px;
    transition: var(--transition);
}

.sub-nav-item.active .counter {
    background: white;
    color: var(--accent);
}

/* Status & Priority Tags */
.status-tag,
.priority-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.kanban-card .priority-tag {
    margin-bottom: 10px;
    padding: 2px 8px;
    /* Slightly smaller for Kanban */
    font-size: 10px;
}

/* Status Variants */
.tag-planned {
    background: #e0f2fe;
    color: #0369a1;
}

.tag-in-progress {
    background: #fef3c7;
    color: #b45309;
}

.tag-waiting-for-response {
    background: #f3e8ff;
    color: #7e22ce;
}

.tag-finish {
    background: #d1fae5;
    color: #047857;
}

/* Work Places Stats */
.wp-stats {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.wp-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wp-stats .highlight {
    color: var(--accent);
    font-weight: 700;
    background: rgba(var(--accent-rgb), 0.1);
    padding: 1px 6px;
    border-radius: 4px;
}

.tag-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

/* Priority Variants */
.tag-urgent {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.tag-high {
    background: #f97316;
    color: white;
}

.tag-medium {
    background: #3b82f6;
    color: white;
}

.tag-low {
    background: #94a3b8;
    color: white;
}

[data-theme="dark"] .tag-planned {
    background: rgba(3, 105, 161, 0.2);
    color: #7dd3fc;
}

[data-theme="dark"] .tag-in-progress {
    background: rgba(180, 83, 9, 0.2);
    color: #fcd34d;
}

[data-theme="dark"] .tag-waiting-for-response {
    background: rgba(126, 34, 206, 0.2);
    color: #d8b4fe;
}

[data-theme="dark"] .tag-finish {
    background: rgba(4, 120, 87, 0.2);
    color: #6ee7b7;
}

[data-theme="dark"] .tag-hold {
    background: rgba(71, 85, 105, 0.2);
    color: #cbd5e1;
}

.sel-opt-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sel-edit-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: var(--transition);
    padding: 4px;
}

.sel-edit-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}


/* Kanban Enhancements */
.kanban-card {
    cursor: default;
    /* Handle is on the content */
}

.kanban-card-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.kanban-card-content:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.15);
}

.kanban-ghost {
    opacity: 0.4;
    background: var(--accent) !important;
    border: 2px dashed var(--accent);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.btn-edit-premium {
    background: rgba(var(--accent-rgb), 0.1) !important;
    border: 1px solid rgba(var(--accent-rgb), 0.2) !important;
    color: var(--accent) !important;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.btn-edit-premium:hover {
    background: var(--accent) !important;
    color: white !important;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.btn-copy {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0.5;
    transition: var(--transition);
}

.btn-copy:hover {
    opacity: 1;
    background: rgba(var(--accent-rgb), 0.1);
    transform: scale(1.2);
}




/* Kanban Board Layout */
.kanban-board {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    overflow-x: auto;
    padding: 10px 10px 24px 10px;
}

.kanban-column {
    background: rgba(var(--text-main-rgb), 0.03);
    border-radius: var(--radius-lg);
    width: 320px;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 1px solid var(--border-color);
    min-height: 600px;
    /* Ensure columns have consistent height for dropping */
}

.kanban-column h3 {
    margin-bottom: 20px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kanban-cards {
    flex: 1;
    /* This is the CRITICAL FIX: it makes the drop zone fill the entire column */
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Selection Settings 3-Column Layout */
.selection-row {
    display: flex;
    gap: 24px;
    margin-top: 20px;
    flex-wrap: wrap;
    /* Added wrap for responsiveness */
}

.selection-column {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-height: 400px;
    /* Reduced from 480 to look better with fewer items */
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
}

.flex-40 {
    flex: 0 0 calc(40% - 18px);
}

.flex-30 {
    flex: 0 0 calc(30% - 18px);
}

.flex-25 {
    flex: 0 0 calc(25% - 18px);
}

/* On smaller screens, make them 50% or 100% */
@media (max-width: 1200px) {
    .flex-25 {
        flex: 0 0 calc(50% - 12px);
    }
}

@media (max-width: 768px) {
    .flex-25 {
        flex: 0 0 100%;
    }
}

.selection-column:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.column-header {
    border-bottom: 2px solid rgba(var(--accent-rgb), 0.1);
    margin-bottom: 20px;
    padding-bottom: 16px;
    display: flex;
    align-items: center;
}

.column-header h4 {
    margin: 0;
    font-size: 15px;
    letter-spacing: 0.5px;
    color: var(--text-main);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.column-header h4 .icon {
    font-size: 18px;
    opacity: 0.9;
}

.selection-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sel-opt-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(var(--text-main-rgb), 0.02);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 14px;
    transition: all 0.2s ease;
}

.sel-opt-item:hover {
    background: white;
    transform: translateX(4px);
    border-color: var(--accent);
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .sel-opt-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sel-opt-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sel-opt-details {
    display: flex;
    flex-direction: column;
}

.sel-opt-label {
    font-weight: 700;
    color: var(--text-main);
}

.sel-opt-value {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.sel-opt-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

.sel-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
    transition: var(--transition);
    opacity: 0;
}

.sel-opt-item:hover .sel-delete-btn {
    opacity: 0.5;
}

.sel-delete-btn:hover {
    opacity: 1 !important;
    color: var(--danger-color);
    background: rgba(var(--danger-color-rgb), 0.1);
}

/* --- Modern 2-Column Modal Overhaul --- */
.modal-content-wide {
    width: 95% !important;
    max-width: 1300px !important;
    padding: 24px !important;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    font-size: 24px;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.modal-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 24px;
    background: rgba(var(--text-main-rgb), 0.05);
    padding: 4px;
    border-radius: var(--radius-md);
    width: fit-content;
}

.tab-item {
    padding: 8px 24px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.tab-item.active {
    background: var(--card-bg);
    color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .modal-content-wide {
    background: #ffffff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    border: 1px solid #ffffff;
}

[data-theme="light"] .fieldset-box {
    border-color: #e0dcd5;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 40%;
    gap: 24px;
    flex: 1;
    overflow-y: auto;
    padding-top: 20px;
    /* Space for absolute legends */
}

/* Fieldset Styling (The Reference Style) */
.fieldset-box {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px 20px 16px;
    margin-bottom: 24px;
    background: rgba(var(--accent-rgb), 0.03);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.fieldset-title {
    position: absolute;
    top: -10px;
    left: 20px;
    background: var(--card-bg);
    padding: 0 12px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.2px;
    color: var(--accent);
    text-transform: uppercase;
}

[data-theme="light"] .fieldset-title {
    color: var(--text-main);
    background: var(--bg-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    top: -12px;
}

.fieldset-box .form-group {
    margin-bottom: 16px;
}

.form-group.no-label label {
    display: none;
}

.form-row-cols {
    display: flex;
    gap: 20px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.flex-1 {
    flex: 1;
}

.attachment-upload {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: rgba(var(--text-main-rgb), 0.03);
    border-radius: var(--radius-md);
}

.btn-outline {
    background: none;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    font-size: 13px;
}

.file-status {
    font-size: 12px;
    color: var(--text-muted);
}

/* Sidebar Log */
.modal-sidebar-col {
    display: flex;
    flex-direction: column;
}

.fieldset-box.full-height {
    height: 100%;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.log-textarea {
    flex: 1;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    resize: none !important;
    font-size: 13px;
    color: var(--text-main);
    line-height: 1.6;
}

.modal-footer-minimal {
    padding-top: 16px;
    display: flex;
    justify-content: flex-start;
}

/* Tab Panes */
.tab-pane {
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.tab-pane.active {
    display: block;
}

/* Sidebar Footer & Diag Indicator */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.3s ease;
}

.dot.online {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: pulse-green 2s infinite;
}

.dot.offline {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.app-version {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.8;
}