body {
    display: flex;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: 1rem;
    position: fixed;
    height: calc(100vh - 36px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.search-container {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: var(--fs-base);
    padding: 0.6rem;
    outline: none;
}

.categories {
    flex: 1;
    margin-bottom: 1rem;
}

.categories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.category-title {
    font-size: var(--fs-sm);
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.edit-categories-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.2rem 0.5rem;
    border-radius: calc(var(--radius) - 1px);
    cursor: pointer;
    font-size: var(--fs-sm);
    transition: border-color 0.15s;
}

.edit-categories-btn:hover {
    border-color: var(--muted);
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.2rem;
    border-radius: calc(var(--radius) - 1px);
    cursor: pointer;
    font-size: var(--fs-sm);
    color: var(--foreground);
    transition: background-color 0.15s;
}

.category-item:hover,
.category-item.active {
    background: var(--background);
}

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

.category-count {
    color: var(--muted);
    font-size: 12px;
    background: var(--background);
    padding: 0.1rem 0.4rem;
    border-radius: calc(var(--radius) - 2px);
}

.category-actions {
    display: none;
    gap: 0.3rem;
}

.category-actions.show {
    display: flex;
}

.category-action-btn {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.1rem 0.3rem;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    font-size: 10px;
    transition: border-color 0.15s;
}

.category-action-btn:hover {
    border-color: var(--muted);
    color: var(--foreground);
}

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

.archive-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    border-radius: calc(var(--radius) - 1px);
    cursor: pointer;
    font-size: var(--fs-sm);
    color: var(--foreground);
    transition: background-color 0.15s;
}

.archive-item:hover,
.archive-item.active {
    background: var(--background);
}

.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 1rem;
    padding-right: 32px;
    width: calc(100vw - 280px);
    max-width: none;
}

.pinned-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 1rem;
}

.content-row {
    margin-bottom: 2rem;
}

.sort-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.sort-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--foreground);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: var(--fs-sm);
    transition: border-color 0.15s;
}

.sort-btn:hover,
.sort-btn.active {
    border-color: var(--muted);
}

/* FIXED GRID SYSTEM */
.notes-grid,
.pinned-notes {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    width: 100%;
}

@media (min-width: 768px) {
    .notes-grid,
    .pinned-notes {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .notes-grid,
    .pinned-notes {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .notes-grid,
    .pinned-notes {
        grid-template-columns: repeat(4, 1fr);
    }
}

.note-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 200px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.note-header {
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
    font-size: var(--fs-base);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.note-content {
    color: var(--muted);
    font-size: var(--fs-sm);
    line-height: 1.4;
    margin-bottom: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    flex: 1;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.note-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.action-btn {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.4rem;
    border-radius: calc(var(--radius) - 1px);
    cursor: pointer;
    transition: border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    border-color: var(--muted);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

.copy-btn.copied {
    border-color: #ff5d8f;
}

.copy-btn.copied svg {
    stroke: #ff5d8f;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 1rem;
}

.modal-input {
    width: 100%;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: var(--fs-base);
    padding: 0.6rem;
    margin-bottom: 1rem;
    outline: none;
}

.modal-textarea {
    width: 100%;
    min-height: 200px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: var(--fs-sm);
    padding: 0.6rem;
    margin-bottom: 1rem;
    outline: none;
    resize: vertical;
    font-family: inherit;
}

.select-wrap {
    position: relative;
    margin-bottom: 1rem;
}

.select-trigger {
    appearance: none;
    width: 100%;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: var(--fs-base);
    padding: 0.6rem 2rem 0.6rem 0.6rem;
    height: 40px;
    cursor: pointer;
    outline: none;
    font-size: 13px;
}

.select-wrap::after {
    content: "";
    pointer-events: none;
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' 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: center;
    opacity: 0.6;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.modal-checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.1rem;
}

.modal-checkbox {
    width: 16px;
    height: 16px;
}

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

.modal-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 500;
}

.btn-save {
    background: #ff5d8f;
    color: var(--background);
    border: none;
}

.btn-cancel {
    background: var(--card);
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-archive,
.btn-delete {
    background: var(--background);
    border: 1px solid var(--border);
    color: white;
    padding: 0.4rem;
    border-radius: calc(var(--radius) - 1px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-archive:hover,
.btn-delete:hover {
    border-color: var(--muted);
}

.btn-delete:hover {
    background: #dc2626;
    color: white;
}

.btn-archive svg,
.btn-delete svg {
    width: 16px;
    height: 16px;
}

.add-note-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: #ff5d8f;
    color: var(--background);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 100;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-size: var(--fs-base);
    color: var(--muted);
}

.hidden {
    display: none !important;
}

.edit-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}
