:root {
    /* Couleurs principales - Thème violet/bleu */
    --bg-body: #0a0e17;
    --bg-sidebar: #0d1219;
    --bg-card: #131a24;
    --bg-card-hover: #1a2332;
    --bg-input: #0d1219;
    --bg-hover: rgba(255, 255, 255, 0.05);
    --border: #1e2a3a;
    --border-light: #2a3a4a;
    --text: #e8eaed;
    --text-dim: #9aa0a6;
    --text-muted: #5f6368;

    /* Accent gradient */
    --accent: #667eea;
    --accent-hover: #5a6fd6;
    --purple: #764ba2;
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-soft: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.1) 100%);

    /* Status */
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;

    /* UI */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 4px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 10px 40px rgba(102, 126, 234, 0.3);
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
}

[data-theme="light"] {
    --bg-body: #f0f2f5;
    --bg-sidebar: #fff;
    --bg-card: #fff;
    --bg-card-hover: #f9fafb;
    --bg-input: #f3f4f6;
    --bg-hover: rgba(0, 0, 0, 0.05);
    --border: #e5e7eb;
    --border-light: #d1d5db;
    --text: #111827;
    --text-dim: #4b5563;
    --text-muted: #9ca3af;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

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

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none !important;
    color: var(--text) !important;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
    padding: 0 !important;
}

.logo-icon i {
    font-size: 1.25rem;
    line-height: 1;
    width: auto;
    height: auto;
    text-align: center;
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-version {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.75rem 1.25rem 0.375rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1.25rem;
    margin: 0 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    text-decoration: none !important;
    transition: var(--transition);
    position: relative;
}

.nav-item i {
    width: 18px;
    text-align: center;
    font-size: 0.95rem;
}

.nav-item span {
    flex: 1;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

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

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--gradient);
    border-radius: 0 4px 4px 0;
}

.nav-badge {
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 2px solid var(--border);
    color: #fff;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.btn-logout {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
    text-decoration: none;
}

/* Main */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin 0.3s ease;
}

.topbar {
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.btn-menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0 !important;
    margin: 0;
    border: none;
    background: var(--bg-hover);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 0;
}

.btn-menu i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    line-height: 1;
    margin: 0 !important;
    padding: 0 !important;
}

.search-global {
    flex: 1;
    max-width: 480px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 1rem;
    transition: var(--transition);
}

.search-global:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.search-global i {
    color: var(--text-muted);
}

.search-global input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    padding: 0.625rem 0;
    font-size: 0.875rem;
}

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

.search-global kbd {
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    gap: 0.5rem;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--bg-hover);
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
}

.topbar-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.page-content {
    padding: 1.5rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none !important;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-warning {
    background: rgba(249, 115, 22, 0.9);
    color: #fff;
}

.btn-warning:hover {
    background: rgba(249, 115, 22, 1);
}

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
}

.btn-group {
    display: flex;
    gap: 0.375rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-dim);
}

.form-label i {
    margin-right: 0.375rem;
    color: var(--accent);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

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

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 1rem;
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background: var(--bg-hover);
    color: var(--text-dim);
}

.badge-primary {
    background: rgba(102, 126, 234, 0.15);
    color: var(--accent);
}

.badge-success {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.badge-purple {
    background: rgba(118, 75, 162, 0.15);
    color: var(--purple);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-body);
}

.table tbody tr:hover td {
    background: var(--bg-hover);
}

.table-actions {
    white-space: nowrap;
}

/* Page layout with sidebar */
.page-with-sidebar {
    display: flex;
    gap: 1.5rem;
}

.content-sidebar {
    width: 280px;
    flex-shrink: 0;
}

.content-main {
    flex: 1;
    min-width: 0;
}

.sidebar-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: 76px;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-body);
}

.sidebar-section-header h4 {
    font-size: 0.8125rem;
    font-weight: 600;
}

.category-nav {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.category-nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-dim);
    text-decoration: none !important;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-size: 0.875rem;
}

.category-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.category-nav-item.active {
    background: var(--gradient-soft);
    color: var(--accent);
    border-left-color: var(--accent);
}

.category-nav-item .cat-icon {
    font-size: 1rem;
}

.category-nav-item span:nth-child(2) {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-count {
    background: var(--bg-body);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    color: var(--text-muted);
    min-width: 22px;
    text-align: center;
}

.cat-actions {
    display: flex;
    gap: 0.125rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.category-nav-item:hover .cat-actions {
    opacity: 1;
}

.cat-actions button {
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
}

.cat-actions button:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Items grid */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
}

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

.item-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.item-card-title {
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.item-card-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.item-card:hover .item-card-actions {
    opacity: 1;
}

.item-card-excerpt {
    color: var(--text-dim);
    font-size: 0.875rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.item-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.item-card-meta i {
    margin-right: 0.25rem;
}

.item-card-cat {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: var(--gradient-soft);
    color: var(--accent);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
}

.item-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.75rem;
}

.tag {
    padding: 0.125rem 0.5rem;
    background: var(--bg-hover);
    border-radius: var(--radius-xs);
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.modal-backdrop.active {
    opacity: 1;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-backdrop.active .modal {
    transform: scale(1);
}

.modal-lg {
    max-width: 720px;
}

.modal-xl {
    max-width: 960px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--gradient-soft);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-body);
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 300px;
    max-width: 420px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

.toast-icon {
    font-size: 1.25rem;
}

.toast-success .toast-icon {
    color: var(--success);
}

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

.toast-warning .toast-icon {
    color: var(--warning);
}

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

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--text-dim);
    margin-top: 0.125rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none !important;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--gradient-soft);
    color: var(--accent);
}

.stat-icon.green {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success);
}

.stat-icon.yellow {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger);
}

.stat-icon.purple {
    background: rgba(118, 75, 162, 0.15);
    color: var(--purple);
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    font-size: 3.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

/* Progress */
.progress {
    height: 6px;
    background: var(--bg-body);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Status dot */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

.status-dot.unknown {
    background: var(--text-muted);
}

/* Icon picker */
.icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.75rem;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    max-height: 150px;
    overflow-y: auto;
}

.icon-opt {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.icon-opt:hover {
    background: var(--bg-hover);
}

.icon-opt.selected {
    background: var(--gradient);
}

/* Kanban */
.kanban-board {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    flex: 0 0 280px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
}

.kanban-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-title {
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kanban-count {
    background: var(--bg-hover);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 100px;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.875rem;
    cursor: grab;
    transition: var(--transition);
}

.kanban-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.kanban-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
}

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

.note-card {
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    transition: var(--transition);
    min-height: 150px;
    display: flex;
    flex-direction: column;
}

.note-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.note-card.pinned {
    box-shadow: 0 0 0 2px var(--accent);
}

.note-card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.note-card-content {
    flex: 1;
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow: hidden;
}

.note-card-footer {
    font-size: 0.7rem;
    margin-top: 0.5rem;
}

/* Markdown */
.markdown-content {
    line-height: 1.7;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
    margin: 1.5rem 0 0.75rem;
    font-weight: 600;
}

.markdown-content h1 {
    font-size: 1.5rem;
}

.markdown-content h2 {
    font-size: 1.25rem;
}

.markdown-content h3 {
    font-size: 1.1rem;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content code {
    background: var(--bg-body);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-xs);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.875em;
}

.markdown-content pre {
    background: var(--bg-body);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 1rem 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-dim);
}

.markdown-content img {
    max-width: 100%;
    border-radius: var(--radius-sm);
}

/* Search results */
.search-results {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none !important;
    color: var(--text);
}

.search-result-item:hover {
    background: var(--gradient-soft);
}

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

.search-result-icon {
    width: 36px;
    height: 36px;
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-weight: 500;
}

.search-result-type {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Shortcuts modal */
.shortcuts-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.shortcuts-modal.active {
    opacity: 1;
    visibility: visible;
}

.shortcuts-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
}

.shortcuts-content h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.shortcuts-grid {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.shortcut {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.shortcut kbd {
    padding: 0.25rem 0.5rem;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-family: monospace;
}

.shortcut span {
    color: var(--text-dim);
    margin-left: auto;
}

/* Page title */
.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.page-title i {
    color: var(--accent);
}

/* Utilities */
.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

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

.text-dim {
    color: var(--text-dim);
}

.text-accent {
    color: var(--accent);
}

.text-center {
    text-align: center;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.font-mono {
    font-family: 'SF Mono', Monaco, monospace;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.flex-wrap {
    flex-wrap: wrap;
}

.items-center {
    align-items: center;
}

.items-start {
    align-items: flex-start;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mt-4 {
    margin-top: 1rem;
}

.ml-auto {
    margin-left: auto;
}

.mr-1 {
    margin-right: 0.25rem;
}

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.grid {
    display: grid;
}

.bg-hover {
    background: var(--bg-hover);
}

/* Cat icons */
.cat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    font-size: 1rem;
}

.cat-icon img {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
}

.category-nav-item .cat-icon img {
    width: 16px;
    height: 16px;
}

.item-card-cat img {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 2px;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.visible {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .btn-menu {
        display: flex;
    }

    .page-with-sidebar {
        flex-direction: column;
    }

    .content-sidebar {
        width: 100%;
    }

    .sidebar-section {
        position: static;
    }

    .category-nav {
        max-height: 200px;
    }

    .search-global kbd {
        display: none;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 13px;
    }

    .page-content {
        padding: 1rem;
    }

    .page-title {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    /* Stack buttons */
    .flex.justify-between {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* Stats grid: 2 columns on tablet */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    /* Tables: horizontal scroll */
    .card.p-0 {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: 0.625rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Kanban: single column */
    .kanban-board {
        flex-direction: column;
    }

    .kanban-column {
        flex: 1 1 auto;
        max-height: none;
    }

    /* Cards */
    .card {
        padding: 1rem;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Items grid */
    .items-grid {
        grid-template-columns: 1fr;
    }

    .notes-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    /* Forms */
    .form-row {
        flex-direction: column;
        gap: 0;
    }

    /* Topbar */
    .topbar {
        padding: 0.5rem 1rem;
    }

    .search-global {
        max-width: 100%;
    }

    /* Touch-friendly buttons */
    .btn {
        min-height: 40px;
        padding: 0.5rem 0.875rem;
    }

    .btn-sm {
        min-height: 34px;
        padding: 0.375rem 0.625rem;
    }

    .topbar-btn {
        width: 40px;
        height: 40px;
    }

    .btn-menu {
        width: 40px;
        height: 40px;
    }

    /* Modals: almost full screen */
    .modal-backdrop {
        padding: 0.5rem;
    }

    .modal {
        max-height: 95vh;
        border-radius: 12px;
    }

    .modal-lg,
    .modal-xl {
        max-width: 100%;
    }

    /* Toast: full width */
    .toast-container {
        left: 0.5rem;
        right: 0.5rem;
        top: auto;
        bottom: 1rem;
    }

    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 12.5px;
    }

    .page-content {
        padding: 0.75rem;
    }

    /* Stats: 1 column */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Sidebar: full width */
    .sidebar {
        width: 100%;
    }

    .sidebar.open {
        box-shadow: none;
    }

    /* Table: hide less important columns on very small screens */
    .table th:nth-child(n+4),
    .table td:nth-child(n+4) {
        display: none;
    }

    /* Search */
    .search-global {
        font-size: 0.8rem;
    }

    .search-results {
        width: 95%;
        top: 60px;
    }
}

/* PWA safe areas (notch, home indicator) */
@supports (padding-top: env(safe-area-inset-top)) {
    .topbar {
        padding-top: env(safe-area-inset-top);
    }

    .sidebar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .page-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

.modal-backdrop:not(.active),
.search-results:not(.active) {
    display: none !important;
    pointer-events: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-secondary) 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-secondary) 0%, var(--accent) 100%);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-body);
}

/* Sidebar scrollbar */
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.5) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 2px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.8);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-secondary) 100%);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--accent-secondary) 0%, var(--accent) 100%);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-body);
}

/* Sidebar scrollbar */
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.5) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.8);
}